let age = -3
assert(age >=0, "A person's age cannot be less than zero")
// this causes the assertion to trigger, because age is not >= 0
The future belongs to those who believe in the beauty of their dreams.
let age = -3
assert(age >=0, "A person's age cannot be less than zero")
// this causes the assertion to trigger, because age is not >= 0
泛型使您能够编写灵活的、可重用的功能和类型的代码。 例如要交换两个变量值的问题不用泛型//Int类型交换func swapTwoInts(inout a: Int, inout b: Int){ let temp = a a = b b = temp}var someInt = 3var anotherInt = 107swapTwoInts(&someInt, &anotherInt)println("someInt is now \(someInt), and ...…