if-else
var temperatureInFahrenheit = 30
if temperatureInFahrenheit <= 32 {
print("It's very cold. Consider wearing a scarf.")
}
// prints "It's very cold. Consider wearing a scarf."
If 后面得条件可以省略小括号
条件后面得大括号不可以省略
If 后面得条件只能是Bool类型
var temperatureInFahrenheit = 30
if temperatureInFahrenheit <= 32 {
print("It's very cold. Consider wearing a scarf.")
}
// prints "It's very cold. Consider wearing a scarf."
If 后面得条件可以省略小括号
条件后面得大括号不可以省略
If 后面得条件只能是Bool类型