int main(int argc, const char * argv[]) {
@autoreleasepool {
//first
void (^myBlock)() = ^{
NSLog(@"myBlock execute");
};
myBlock();
//second return value
int (^sum)(int, int) = ^int(int x, int y){
return x+y;
};
NSLog(@"sum = %d", sum(2, 6));
//third
Calc *c = [[Calc alloc] init];
NSLog(@"s = %d", [c calcNum1:10 withNum2:20 andCalcWith:sum]);
NSLog(@"value = %d", [c calcNum1:10 withNum2:30 andCalcWith:^int(int x, int y) {
return x*y;
}]);
}
return 0;
}int main(int argc, const char * argv[]) {
@aut