Skip to content

Commit 9b1411a

Browse files
committed
Update for-comprehensions.md
1 parent 880b6ea commit 9b1411a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

_ba/tour/for-comprehensions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ Ovdje je `n == 10` i `v == 10`. U prvoj iteraciji, `i == 0` i `j == 0` tako da `
5454
Bez `if` čuvara, ovo bi ispisalo sljedeće:
5555
```
5656
57-
(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, 7) (0, 8) (0, 9) (1, 1) ...
57+
(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, 7) (0, 8) (0, 9) (1, 0) ...
5858
```

_zh-cn/tour/for-comprehensions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ foo(10, 10) foreach {
4646
```
4747
这里 `n == 10``v == 10`。在第一次迭代时,`i == 0` 并且 `j == 0` 所以 `i + j != v` 因此没有返回值被生成。在 `i` 的值递增到 `1` 之前,`j` 的值又递增了 9 次。如果没有 `if` 语句过滤,上面的例子只会打印出如下的结果:
4848
```scala
49-
(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, 7) (0, 8) (0, 9) (1, 1) ...
49+
(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, 7) (0, 8) (0, 9) (1, 0) ...
5050
```
5151

5252
注意 for 表达式并不局限于使用列表。任何数据类型只要支持 `withFilter``map`,和 `flatMap` 操作(不同数据类型可能支持不同的操作)都可以用来做序列推导。

0 commit comments

Comments
 (0)