For Expressions

For expressions are a very useful construct that can simplify manipulation of collections and several other data structures. They can be used in place of nested for loops, or to replace calls to map and flatMap in non-collection structures.

The video below introduces the concept of for expressions and explains them with some good examples:

For Expressions in Scala - BoldRadius Blog

Looking for more? This article has a short, but good example of for comprehension de-sugaring.

For a more comprehensive look, check out the official Scala-Lang documentation on this topic.

Before moving on to Featured Types, make sure that you have a solid grasp on For Expressions by completing the quiz below.