8000 Fixed code to match comments · soronpo/scala.github.com@513854e · GitHub
[go: up one dir, main page]

Skip to content

Commit 513854e

Browse files
author
Sal Borrelli
authored
Fixed code to match comments
Comments on lines 53 and 54 make me think that the program prints something as output, which obviously wasn't the case in the provisous version. I've added the calls to "println" which are necessary to match the corresponding comments.
1 parent 84cf61d commit 513854e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_tour/traits.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class IntIterator(to: Int) extends Iterator[Int] {
5050
5151
5252
val iterator = new IntIterator(10)
53-
iterator.next() // prints 0
54-
iterator.next() // prints 1
53+
println(iterator.next()) // prints 0
54+
println(iterator.next()) // prints 1
5555
```
5656
This `IntIterator` class takes a parameter `to` as an upper bound. It `extends Iterator[Int]` which means that the `next` method must return an Int.
5757

0 commit comments

Comments
 (0)
0