Created
June 29, 2013 18:02
-
-
Save joethephish/5892073 to your computer and use it in GitHub Desktop.
The dangers of using [NSArray count] in if statements! (because count is an NSUInteger)
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
NSArray *array = @[@"a", @"b"]; | |
if( array.count - 3 >= 5 ) { | |
NSLog(@"Big!"); | |
} else { | |
NSLog(@"Small!"); | |
} | |
// --> Big! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment