Objective-C Language Defining and Assigning


Example

A block that performs addition of two double precision numbers, assigned to variable addition:

double (^addition)(double, double) = ^double(double first, double second){
    return first + second;
};

The block can be subsequently called like so:

double result = addition(1.0, 2.0); // result == 3.0