Sunday, August 24, 2014

Implicitly Converting Functions to Return Optionals

Airspeed Velocity:

As we saw previously, if you pass a non-optional value to a function argument that expects an optional, it will get automatically converted into an optional by the compiler.

Ken Ferry points out something that goes one step further. If a function takes an argument of a function that returns an optional, and you pass into it a function that does not return an optional, the function will automatically be converted to return an optional.

Comments RSS · Twitter

Leave a Comment