Is it possible to assign a local variable a value whose scope is outside a block and have it retain its value? In particular, I\'m coding for iOS and I have a nested block i
you are simply defining your block but not calling it.
Try this :)
__block NSString *str; void (^someBlock)(id) = ^(id param1) { str = @"iPhone"; }; someBlock(nil); [str getCharAtIndex:1];
In this case I call it directly but usually the block itself is a parameter of some method or function.