For Comprehensions - Scala Documentation

Scala offers a lightweight notation for expressing sequence comprehensions. Comprehensions have the form for (enumerators) yield e, where enumerators refers to a semicolon-separated list of enumerators. An enumerator is either a generator which introduces new variables, or it is a filter. A comprehension evaluates the body e for each binding generated by the enumerators and returns a sequence of these values.


This is a companion discussion topic for the original entry at http://docs.scala-lang.org//tutorials/tour/for-comprehensions.html.html