48> let b = 0b110 // 二进制 b: Int = 6 49> let b = 0o11 // 八进制 b: Int = 9 50> let b = 0x11 // 十六进制
大数字表示法
1 2
53> let big = 1_000_000_000 big: Int = 1000000000
轻松显示
1 2 3 4 5 6 7 8 9 10
59> let city = "shanghai" city: String = "shanghai" 60> let food = "noodle" food: String = "noodle" 61> let restaurant = "KFC" restaurant: String = "KFC" 62> let year = 5 year: Int = 5 63> print ("When I visited \(city) \(year) years ago, I went to \(restaurant) and ordered \(food)") When I visited shanghai 5 years ago, I went to KFC and ordered noodle