O'Reilly logo

Mastering Swift 4 - Fourth Edition by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using case and where statements with conditional statements

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 look at some examples, starting off with using the where statement to filter the results in a for-in loop.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required