Switch and Enums

suggest change

The Switch statement works very well with Enum values

enum CarModel {
    case Standard, Fast, VeryFast
}

let car = CarModel.Standard

switch car {
case .Standard: print("Standard")
case .Fast: print("Fast")
case .VeryFast: print("VeryFast")
}
Since we provided a case for each possible value of car, we omit the default case.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents