
/**
if 语句的多分支执行
*/
let score:Double = 98.5
var res:String = ""
if score >= 90 {
res = "优秀"
} else if score >= 80 {
res = "良好"
} else if score >= 60 {
res = "及格"
} else if score >= 0 {
res = "不及格"
}
if score >= 90 {
res = "优秀"
} else {
if score >= 80 {
res = "良好"
} else {
if score >= 60 {
res = "及格"
}
else {
// if <#condition#> {
// <#code#>
// }
}
}
}
print(res)
总结以上是内存溢出为你收集整理的4.2 Swift中if语句的多分支执行全部内容,希望文章能够帮你解决4.2 Swift中if语句的多分支执行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)