Ray Wenderlich Functions and Types Course - Part 3
Here we go! Getting back into a routine with this! Straight on to continue closures... Start Time - 19:45 Closure Syntax Writing closures inline is one of the main benefits. Using shorter syntax can make them easier but can also make it more complicated to figure out... This old chestnut I've seen before. let longClosure = { (a: Int , b: Int ) -> Int in return a * b } longClosure ( 4 , 3 ) let noParameterTypes = { (a, b) -> Int in a * b } let noReturnTypes : Operate = { (a, b) in a * b } let shortClosure : Operate = { $0 * $1 } noParameterTypes ( 4 , 3 ) noReturnTypes ( 4 , 3 ) shortClosure ( 4 , 3 ) The difference is that there was a type alias with the closure signature there. Here is a point about trailing closures - // -------------------------------------- func printResult ( _ a: Int , _ b: Int , _...