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
Copy file name to clipboardExpand all lines: docs/docs/reference/other-new-features/indentation.md
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -387,6 +387,17 @@ xs.map:
387
387
y * y
388
388
```
389
389
390
-
Colons at the end of lines are their own token, distinct from normal `:`.
391
-
TheScala grammar is changed in this variant so that colons at end of lines are accepted at all points
392
-
where an opening brace enclosing a function argument is legal. Special provisions are taken so that method result types can still use a colon on the end of a line, followed by the actual typeon the next.
390
+
The colon is usable not only for lambdas and by-name parameters, but
391
+
also even for ordinary parameters:
392
+
393
+
```scala
394
+
credentials ++:
395
+
valfile=Path.userHome /".credentials"
396
+
if file.exists
397
+
thenSeq(Credentials(file))
398
+
elseSeq()
399
+
```
400
+
401
+
How does this syntax variant work?Colons at the end of lines are their own token, distinct from normal `:`.
402
+
TheScala grammar is changed so that colons at end of lines are accepted at all points
403
+
where an opening brace enclosing an argument is legal. Special provisions are taken so that method result types can still use a colon on the end of a line, followed by the actual typeon the next.
0 commit comments