How would one go about writing a one line if statement in objective-c? Is there a proper style for this?
I know of the ternary operator used for assignment (int a = condition ? b : c) but say I wanted to call a method is if(condition){ [self methodCall]; } the recommended way of dealing with this in one line?
In addition are there any objc style guides out there? (Think comparable to this ruby style guide) Coming back to a language after a while of not touching it makes me want to rethink how I style my code.
The single-line ruby-style
ifandunlessstatements do not have an equivalent in Objective-C. You can either stick with blocks, or just call the method on the same line:or
or