Skip to content

Instantly share code, notes, and snippets.

@rumandcode
Created November 10, 2013 11:35
Show Gist options
  • Save rumandcode/7397133 to your computer and use it in GitHub Desktop.
Save rumandcode/7397133 to your computer and use it in GitHub Desktop.
Example of a recursive block in Objective-C
__unsafe_unretained __block void (__weak ^recursiveBlock)(int, int) = ^ void (int a, int b) {
NSLog(@"%d", a);
int n = a + b;
recursiveBlock(b, n);
};
recursiveBlock(0, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment