Swift Programming Language

31 thoughts
last posted Aug. 6, 2014, 9:41 p.m.

12 earlier thoughts

0

An additional nice thing about the if let syntax is that methods like .toInt() return optionals (rather than raising an exception) so you can do things like:

if let myInt = someValue.toInt() {
    // myInt is someValue converted to an Integer
} else {
   // someValue is not convertible to an Integer
}

18 later thoughts