Swift 3 Switch Statement
These are formatted so you can copy the code straight into your Swift Playground or Xcode Swift files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
//the variable to check in the switch statement... let bandMember:String = "Bob" //the switch statement... switch bandMember { case "Jerry": print("found Jerry") case "Bobby": print("found Bobby") default: print("couldn't find him") } |
If you’re looking for places to learn after these Swift examples, check out CartoonSmart.com or SpriteKitLessons.com