Skip to content

Instantly share code, notes, and snippets.

@bgerstle
Created January 28, 2016 19:51
Show Gist options
  • Save bgerstle/771c19b1617647540802 to your computer and use it in GitHub Desktop.
Save bgerstle/771c19b1617647540802 to your computer and use it in GitHub Desktop.
If statement examples in ObjC
- (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