enum Phone {
case iphone11pro
case iphonese
case pixel
case nokia
}
func getSeansOpinion(on phone: Phone) {
if phone == .iphone11pro {
print("Great overall phone")
} else if phone == .iphonese {
print("its alrigth, but a small phone")
} else if phone == .pixel {
print("great camera")
} else if phone == .nokia {
print("great durability")
} else {
print("don't know about this one")
}
}
getSeansOpinion(on: .iphone11pro)
output
"Great overall phone"
enum Phone: String {
case iphone11pro = "Great overall phone"
case iphonese = "its alrigth, but a small phone"
case pixel = "great camera"
case nokia = "great durability"
}
func getSeansOpinion(on phone: Phone) {
print(phone.rawValue)
}
getSeansOpinion(on: .iphone11pro)
output
"Great overall phone"