swift中switch-case case后默认加入了break,如果要继续执行下面的代码就需要加入fallthough例如:
var age = 1
switch age{
case 0...3:
print("幼年")
fallthough
case 3...18:
print("青年")
}
swift中switch-case case后默认加入了break,如果要继续执行下面的代码就需要加入fallthough例如:
var age = 1
switch age{
case 0...3:
print("幼年")
fallthough
case 3...18:
print("青年")
}