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