Swift匹配范围
示例
switch语句中的单个大小写可以匹配一系列值。
let number = 20switch number {
case 0:
print("Zero")
case 1..<10:
print("Between One and Ten")
case 10..<20:
print("Between Ten and Twenty")
case 20..<30:
print("Between Twenty and Thirty")
default:
print("Greater than Thirty or less than Zero")
}
以上是 Swift匹配范围 的全部内容, 来源链接: utcz.com/z/321269.html