Possible Duplicate:
What does the question mark and the colon (?: ternary operator) mean in objective-c?
I have seen code where it uses a syntax something like…
someValue = someBoolean ? valueOne : valueTwo;
Or something like this.
I’ve never used this and I’m not sure what it’s called.
Please can someone explain how to use it or provide a link to a resource about it.
It’s ternary opertaor.
It evaluates the
someBooleancondition.If it is true then pass the
valueOnetosomeValueIf it is false then pass
valueTwotosomeValueIt is equal to:
This is a good link which explains about ternary operator