Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _tour/for-comprehensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def foo(n: Int, v: Int) =

foo(10, 10) foreach {
case (i, j) =>
print(s"($i, $j) ") // prints (1, 9) (2, 8) (3, 7) (4, 6) (5, 5)
println(s"($i, $j) ") // prints (1, 9) (2, 8) (3, 7) (4, 6) (5, 5)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the output would be

(1, 9)
(2, 8)
(3, 7)
(4, 6)
(5, 5)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but not sure the difference is worth the vertical space

}

```
Expand All @@ -60,7 +60,7 @@ You can omit `yield` in a comprehension. In that case, comprehension will return
def foo(n: Int, v: Int) =
for (i <- 0 until n;
j <- i until n if i + j == v)
print(s"($i, $j)")
println(s"($i, $j)")

foo(10, 10)
```