None
EN
Anonymous Functions
['Sam Khawase']
Home on Sam Khawasé
The following code declares a block with the name areaCalculatorBlock which returns a double and takes two parameters of type double - (void)aMethod { double outerHeight = 100; double outerWidth = 200; double (^areaCalculatorBlock)(void) = ^double(void){ return outerHeight * outerWidth; } NSLog("area is: %ld", areaCalculatorBlock()); } __block double sharedHeight = 100; __block double sharedWidth = 200; - (void)aMethod{ double (^areaCalculatorBlock)(void) = ^double(void){ return sharedHeight * sharedWidth; } NSLog("area is: %ld", areaCalculatorBlock()); }