Can someone please help to explain the syntax of the following code for me? It meant to "return ? if _suit
is nil
, and return a corresponding string in an array if _suit
is not nil
".
- (NSString *)suit
{
return _suit ? _suit : @"?";
}
Is it equivalent to the following code?
if (!_suit) {
return @"?";
} else {
return ?
}