Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

Swift enum With Switch Statement

enum PizzaSize {
  case small, medium, large
}

var size = PizzaSize.medium

switch(size) {
  case .small:
    print("I ordered a small size pizza.")

  case .medium:
    print("I ordered a medium size pizza.")

   case .large:
     print("I ordered a large size pizza.");
}
 
PREVIOUS NEXT
Tagged: #Swift #enum #With #Switch #Statement
ADD COMMENT
Topic
Name
7+5 =