Simple conditions of switch/case statements in Swift
Forums:
var str: String;
let monitorInchSize = 24
switch monitorInchSize {
case 15:
str = "too small"
case 16,17,18:
str = "good for the past decade"
case 19...23:
str = "for office work"
case 24...27:
str = "great choice"
default:
str = ""
}
//str is "great choice"
- Log in to post comments