问题是 ;
// NSString *(^block2)(NSString *name; int age) = ^(NSString *name, int age){
NSString *(^block2)(NSString *name,int age) = ^(NSString *name, int age){
return [NSString stringWithFormat:@"姓名: %@, 年龄: %d",name , age];
};
NSString *ret = block2(@"小明",26);
NSLog(@"ret: %@", ret);
问题: (int)
int (^block2)(NSString *name);
block2 = ^(NSString *name){
// return name.length;
return (int)name.length;
};
int ret2 = block2(@"李四");
NSLog(@"李四哥:ret2 = %d",ret2);