Changes

The Swift Switch Statement

2 bytes removed, 19:44, 1 November 2016
no edit summary
In [[Swift 2 Flow Control]] we looked at how to control program execution flow using the if and else statements. Whilst these statement constructs work well for testing a limited number of conditions, they quickly become unwieldy when dealing with larger numbers of possible conditions. To simplify such situations, Swift has inherited the switch statement from the C programming language. Those familiar with the switch statement from other programming languages should be aware, however, that the Swift switch statement has some key differences from other implementations. In this chapter we will explore the Swift implementation of the switch statement in detail.
== Why Use a switch Statement? ==