Skip to content

Instantly share code, notes, and snippets.

@lin
Created January 29, 2015 03:44
Show Gist options
  • Select an option

  • Save lin/4d16ac922b6c9e55ba1b to your computer and use it in GitHub Desktop.

Select an option

Save lin/4d16ac922b6c9e55ba1b to your computer and use it in GitHub Desktop.
void (^logMessage) = ^{
NSLog(@"Hello from inside the block");
};
void (^sumNumbers)(NSUInteger, NSUInteger) = ^(NSUInteger num1, NSUInteger num2){
NSLog(@"The sum of the numbers is %lu", num1 + num2);
};
for (NSString *word in funnyWords) {
NSLog(@"%@ is a funny word", word);
}
[funnyWords enumerateObjectsUsingBlock:
^(NSString *word, NSUInteger index, BOOL *stop){
NSLog(@"%@ is a funny word", word);
}
];
@interface Person : NSObject
@property NSString *firstName;
@property NSString *lastName;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment