元组将多个值组合为单个值.元组内的值可以是任意 类型,各元素不必是相同的类型.元组在作为函数返 回值时尤其有用. 1.定义方法1 let http404Error= (404,"Not Found") println("The status codeis \(http404Error.0)") // prints "The status codeis 404" println("The statusmessage is \(http40
我们已经了解了Python支持布尔类型的数据,布尔类型只有True和False两种值,但是布尔类型有以下几种运算:与运算:只有两个布尔值都为 True 时,计算结果才为 True.True and True # ==> TrueTrue and False # ==> FalseFalse and True # ==> FalseFalse and False # ==> False或运算:只要有一个布尔值为 True,计算结果就是 True.True or Tru