#scala #sequence-comprehension
There is also a special form of sequence comprehension which returns Unit. Here the bindings that are created from the list of generators and filters are used to perform side-effects. The programmer has to omit the keyword yield to make use of such a sequence comprehension.
If you want to change selection, open document below and click on "Move attachment"

Sequence Comprehensions - Scala Documentation
program uses iterators instead. Every datatype that supports the operations filterWith, map, and flatMap (with the proper types) can be used in sequence comprehensions. Here’s the output of the program: (13, 19) (14, 18) (15, 17) (16, 16) <span>There is also a special form of sequence comprehension which returns Unit. Here the bindings that are created from the list of generators and filters are used to perform side-effects. The programmer has to omit the keyword yield to make use of such a sequence comprehension. Here’s a program which is equivalent to the previous one but uses the special for comprehension returning Unit: object ComprehensionTest3 extends App { for (i <- Iterator.range(0,