8.5 Range Matching in a switch Statement
The case statements within a switch construct may also be used to implement range matching. The following switch statement, for example, checks a temperature value for matches within three number ranges:
let temperature = 83
switch (temperature)
{
case 0...49:
print("Cold")
case 50...79:
print("Warm")
case 80...110:
print("Hot")
default:
print("Temperature out of range")
}