Treehouse Intermediate Course - Part 13 (Closures 5)
OK so I wasn't able to code on the coach back but a bit of closures before bed! Let's go! Start Time - 21:28 Throwing From Inside A Closure extension Int { func apply( _ value: Int , operation: ( Int , Int ) -> Int ) -> Int { return operation( self , value) } } So this extension gives the function of adding or another operator with an integer. 10 .apply( 12 ) { $0 + $1 } That's all good! But with something like divide, there would be an error! Right before we go any further let's just review what Pasan has shown... extension Int { func apply( _ value: Int , operation: ( Int , Int ) throws -> Int ) -> Int { do { return try operation( self , value) } catch { ...