mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Fix issue with calling block code.
Fixes https://github.com/adambard/learnxinyminutes-docs/issues/1598
This commit is contained in:
parent
3d70c872e4
commit
3a968a826b
@ -688,7 +688,7 @@ addUp = ^(int n) { // Remove (int n) to have a block that doesn't take in any pa
|
|||||||
mutableVar = 32; // Assigning new value to __block variable.
|
mutableVar = 32; // Assigning new value to __block variable.
|
||||||
return n + outsideVar; // Return statements are optional.
|
return n + outsideVar; // Return statements are optional.
|
||||||
}
|
}
|
||||||
int addUp = add(10 + 16); // Calls block code with arguments.
|
int addUp = addUp(10 + 16); // Calls block code with arguments.
|
||||||
// Blocks are often used as arguments to functions to be called later, or for callbacks.
|
// Blocks are often used as arguments to functions to be called later, or for callbacks.
|
||||||
@implementation BlockExample : NSObject
|
@implementation BlockExample : NSObject
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user