定义和分配
执行添加两个双精度数的块,分配给变量 addition
:
double (^addition)(double, double) = ^double(double first, double second){
return first + second;
};
随后可以像这样调用块:
double result = addition(1.0, 2.0); // result == 3.0
执行添加两个双精度数的块,分配给变量 addition
:
double (^addition)(double, double) = ^double(double first, double second){
return first + second;
};
随后可以像这样调用块:
double result = addition(1.0, 2.0); // result == 3.0