Skip to content

Commit e4f2390

Browse files
alvinjjulienrf
andcommitted
Update _overviews/overview/a-taste-of-scala.md
Co-authored-by: Julien Richard-Foy <[email protected]>
1 parent 8a1d644 commit e4f2390

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

_overviews/overview/a-taste-of-scala.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,13 @@ println(s"Name: $firstName $mi $lastName") // "Name: John C Doe"
247247

248248
Just precede the string with the letter `s`, and then put a `$` symbol before your variable names inside the string.
249249

250-
For expressions more complex than a single identifier, enclose the expression in curly braces:
250+
To enclose expressions inside a string, enclose them in curly braces:
251251

252-
```scala
252+
~~~ scala
253253
println(s"2 + 2 = ${2 + 2}") // prints "2 + 2 = 4"
254-
```
254+
val x = -1
255+
println(s"x.abs = ${x.abs}") // prints "x.abs = 1"
256+
~~~
255257

256258
#### Other interpolators
257259

@@ -1320,4 +1322,3 @@ Scala has even more features that weren’t covered in this whirlwind tour. See
13201322

13211323

13221324

1323-

0 commit comments

Comments
 (0)