You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At least on the latest nightly (Scala
3.2.2-RC1-bin-20220910-ac6cd1c-NIGHTLY), the example without colons
doesn't seem to work. Also, the `foldLeft` call seems to be missing the
initial value.
Copy file name to clipboardExpand all lines: docs/_docs/reference/experimental/fewer-braces.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -52,11 +52,11 @@ val firstLine = files.get(fileName).fold:
52
52
53
53
Braces can also be omitted around multiple line function value arguments:
54
54
```scala
55
-
val xs = elems.map x =>
55
+
val xs = List.range(1, 10).map: x =>
56
56
val y = x - 1
57
57
y * y
58
-
xs.foldLeft (x, y) =>
59
-
x + y
58
+
xs.foldLeft(0): (x, y) =>
59
+
x + y * 8
60
60
```
61
61
Braces can be omitted if the lambda starts with a parameter list and `=>` or `=>?` at the end of one line and it has an indented body on the following lines.
0 commit comments