Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Swift Switch Statement with Range

let ageGroup = 33

switch ageGroup {
  case 0...16:
    print("Child")

  case 17...30:
    print("Young Adults")

  case 31...45:
    print("Middle-aged Adults")

  default:
    print("Old-aged Adults")
}
 
PREVIOUS NEXT
Tagged: #Swift #Switch #Statement #Range
ADD COMMENT
Topic
Name
7+4 =