Iterate with for
In this lesson, you will be introduced to the for expression.
We'll cover the following
Introduction
We sometimes come across scenarios where a block of code needs to be executed multiple times. The for
expression is one such control structure that does just that. Scala’s for
expression provides a wide variety of ways to express iterations depending on the object you want to iterate over; the simplest being a collection.
Control Flow
Let’s look at the general control flow of a for
expression below.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy