letminValue=UInt8.minletmaxValue=UInt8.maxprintln("UInt8 min value is \(minValue) and max value is \(maxValue)")//输出 UInt8 min value is 0 and max value is 255
let(statusCode,statusMessage)=http404Errorprintln("The status code is \(statusCode)")// 输出 "The status code is 404"println("The status message is \(statusMessage)")// 输出 "The status message is Not Found"
println("The status code is \(http404Error.0)")// 输出 "The status code is 404"println("The status message is \(http404Error.1)")// 输出 "The status message is Not Found"
println("The status code is \(http200Status.statusCode)")// 输出 "The status code is 200"println("The status message is \(http200Status.description)")// 输出 "The status message is OK"
letpossibleNumber="123"letconvertedNumber=possibleNumber.toInt()ifconvertedNumber!=nil{println("\(possibleNumber) has an integer value of \(convertedNumber!)")}else{println("\(possibleNumber) could not be converted to an integer")}// 打印 123 has an integer value of 123//不加! 打印123 has an integer value of Optional(123)
ifletactualNumber=possibleNumber.toInt(){println("\(possibleNumber) has an integer value of \(actualNumber)")}else{println("\(possibleNumber) could not be converted to an integer")}// 输出 "123 has an integer value of 123"