Created
October 1, 2013 04:29
-
-
Save dermotos/6773870 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)doCodeSnippetWithCompletion:(void(^)())block{ | |
//dispatching to background queue | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
NSString *code = @"Code", *test = @"Test"; | |
BOOL iterationPrinted = NO; | |
for (int x = 1; x<=100; x++) { | |
iterationPrinted = NO; | |
if(x % 3 == 0 && x % 5 == 0) | |
NSLog(@"%@%@",code,test); | |
else if(x % 5 == 0) | |
NSLog(@"%@",test); | |
else if(x % 3 == 0) | |
NSLog(@"%@",code); | |
else | |
NSLog(@"%d",x); | |
} | |
if(block) //completion callback (optional) | |
block(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment