Looking for objective-c Keywords? Try Ask4Keywords

Objective-C Language 定义和分配


执行添加两个双精度数的块,分配给变量addition

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

随后可以像这样调用块:

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