Skip to content

Instantly share code, notes, and snippets.

@cqa02303
Created May 15, 2014 08:03
Show Gist options
  • Save cqa02303/6b2bfaed9298cec51c68 to your computer and use it in GitHub Desktop.
Save cqa02303/6b2bfaed9298cec51c68 to your computer and use it in GitHub Desktop.
__block NSNumber *val = [NSNumber numberWithInt:0];
void (^blk)(void) = ^{
__block NSNumber *val1 = val;
void (^blk2)(void) = ^{
val1 = [NSNumber numberWithInt:1];
};
NSLog(@"val:%@ val1:%@", val, val1);
val = [NSNumber numberWithInt:2];
NSLog(@"val:%@ val1:%@", val, val1);
val1 = [NSNumber numberWithInt:3];
NSLog(@"val:%@ val1:%@", val, val1);
blk2();
NSLog(@"val:%@ val1:%@", val, val1);
};
blk();
NSLog(@"val:%@", val);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment