- while
var startIndex = 0
var finalValue = 10
while startIndex < finalValue {
startIndex += 1
}
print("Game Over")
- repeat while
repeat {
startIndex += 1
print(startIndex)
} while startIndex < finalValue
- switch
let someCharacter:Character = "z"
switch someCharacter {
case "a":
print("a")
case "z":
print("z")
default:
print("没找到")
}
- where
let point = (1,-1)
switch point {
case let(x,y) where x == y:
print("x == y")
default:
print("x != y")
}