
CH05.playground
if 3 > 5 {
println("3大於5發生了!")
}
if 3 > 5 {
println("3大於5發生了!")
}
else {
println("3沒有大於5!")
}
if 3 > 5 {
println("3大於5發生了!");
}
else if 4 > 5 {
println("4大於5發生了!");
}
else if 5 > 5 {
println("5大於5發生了!");
}
else if 6 > 5 {
println("6當然大於5哩!");
}
else {
println("沒有符合的條件");
}
switch 6 {
case 3:
println("選擇是3...");
case 4:
println("選擇是4...");
case 5:
println("選擇是5...");
case 6:
println("選擇是6...");
default:
println("沒有符合的");
}
switch "a" {
case "v", "c", "f":
println("v c f")
case "a", "b":
println("a b")
default:
println("No matches!")
}
switch 65 {
case 0...59:
println("Not Good!")
case 60...69:
println("Good!")
case 70...79:
println("Great!")
default:
println("No matches!")
}the end
沒有留言:
張貼留言