let value = 20 if (value > 20) { print("大于20") } else if (value < 20) { print("小于20") } else { print("等于20") } let switchCondition:String = "jzh" switch switchCondition { case "jzh": print("ok jzh"); fallthrough case "jiang": print("ok jiang"); fallthrough default: print("ok idodo") } let price = 100 switch price { case 0: print("免费") case 10..<50: print("超低价") case 50..<100: print("低价") case 100...500: print("价格适中") case 501...999_999_999: print("贵") default: print("非常贵") } for index in 1...5 { print("\(index)") } let names = ["a", "b", "c", "d"] for name in names { print("Hello, \(name)!") } var index = 10 while index < 20 { print( "index 的值为 \(index)") index = index + 1 }