For Expressions
Learn about “for expressions” in Scala.
For loops?
The for
expression in Scala is a very powerful feature. It can be used similar to a normal “for loop” but can also be used for parallel programming and to avoid null-pointer exceptions.
First, we will discuss how to avoid null-pointer exceptions. Scala has Option
for this, which has two implementations: Some
and None
. Some wrapping a value, and None
representing a null value.
For example, imagine we want ...
Access this course and 1400+ top-rated courses and projects.