Skip to content

Commit 2d096b2

Browse files
author
Ali Hong
committed
Clarify what a 'generator' is in A Taste of Scala
1 parent a02b6c9 commit 2d096b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

_overviews/scala3-book/taste-control-structures.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ val ints = List(1, 2, 3, 4, 5)
9292
for (i <- ints) println(i)
9393
```
9494

95-
> The code `i <- ints` is referred to as a _generator_, and the code that follows the closing parentheses of the generator is the _body_ of the loop.
95+
> The code `i <- ints` is referred to as a _generator_. In any generator `p <- e`, the expression `e` can generate zero or many bindings to the pattern `p`.
96+
> The code that follows the closing parentheses of the generator is the _body_ of the loop.
9697
9798
{% endtab %}
9899

0 commit comments

Comments
 (0)