Closures example swift – How to write ?

By | August 1, 2016

Closures example swift – How to write ?

Closure gives the feature to write an inline function block. Here. we have taken an example of array mapping.

Notice the “!” mark in dictionary subscript. It is used because a dictionary always returns an optional value making sure the case that a key might contain empty value. Here, number % 10 will always fetch a value from dictionary so we’ve used forced unwrapping.