*/
#import <Foundation/Foundation.h>
typedef void (^Block)();
int main(int argc, const char * argv[]) {
void (^hello)()=^(){
NSLog(@"blockhello");
};
hello();
Block Myblock2=^(){
NSLog(@"Myblock2");
};
Myblock2();
int (^add)(int a,int b)=^(int a,int b){
NSLog(@"%d+%d=%d",a,b,a+b);
return a+b;
};
add(4,3);
__block int a=0;
void (^Myblock)()=^(){
a=5;
NSLog(@"外部%d",a);
};
Myblock();
return 0;
} |
|