As we saw in the last section, the case and where statements within a switch statement can be very powerful. Using case and where statements within our conditional statements can also make our code much smaller and easier to read. Conditional statements, such as if, for, and while, can also make use of the where and case keywords. Let's take a look at some examples, starting off with using the where statement to filter the results in a for-in loop.
Using case and where statements with conditional statements
Filtering with the where statement
In this example, we will take an array of integers and print out only multiples of 3. However, before we look at how to filter the results with the where statement, let's take...