📅  最后修改于: 2021-01-11 07:34:47             🧑  作者: Mango
Swift语言可以帮助您在if-else语句中使用if-else语句。嵌套的if-else语句也可以在Swift的switch语句中使用。
let n1 = 10, n2 = 22, n3 = 25
if n1 >= n2 {
if n1 >= n3 {
print("The largest number is ", n1)
}
else {
print("The largest number is ", n3)
}
}
else {
if n2 >= n3 {
print("The largest number is ", n2)
}
else {
print("The largest number is ", n3)
}
}
输出:
The largest number is 25