Created
January 28, 2016 19:51
-
-
Save bgerstle/771c19b1617647540802 to your computer and use it in GitHub Desktop.
If statement examples in ObjC
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
- (int)exampleA { | |
if (foo) { | |
return 1; | |
} | |
// no man's land for side effects | |
if (bar) { | |
return 2; | |
} | |
// more no man's land | |
return WMFDefaultValue; | |
} | |
- (int)exampleB { | |
if (foo) { | |
return 1; | |
} else if (bar) { | |
return 2; | |
} | |
// no man's land | |
return WMFDefaultValue; | |
} | |
- (int)exampleC { | |
if (foo) { | |
return 1; | |
} else if (bar) { | |
return 2; | |
} else { | |
return WMFDefaultValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment