It is a ternary operator
(also known as the conditional operator
). You can find explanation at this link.
Basically your expression is saying that if someBoolean
is true someValue will get valueOne
if not it will get valueTwo
.
It is similar to:
if(someBoolean)
{
someValue = valueOne;
}
else
{
someValue = valueTwo;
}
which offers less visibility in your code. I recommend using this operator in case you want to assign a value which depends on one condition.
Note that it is an expression not specific to Objective-C
, you can use it in C
and C++
too.