8.4 Combining case Statements
In the above example, each case had its own set of statements to execute. Sometimes a number of different matches may require the same code to be executed. In this case, it is possible to group case matches together with a common set of statements to be executed when a match for any of the cases is found. For example, we can modify the switch construct in our example so that the same code is executed regardless of whether the value is 0, 1 or 2:
let value = 1
switch (value)
{
case 0, 1, 2:
print("zero, one or two")
case 3:
print("three")
case 4:
print("four")
case 5:
...