1

Please forgive the title, it's probably wrong, since I don't know anything about it. Because of that, I didn't have any search terms to look it up, so could someone explain me what does this mean and how to use it? I just picked this example as I recently found it.

id item = [arr count] > 0 ? arr[0] : nil;
imas145
  • 1,959
  • 1
  • 23
  • 32

1 Answers1

4

This line is the same as

id item;
if ([arr count] > 0) {
   item = arr[0];
}else{
   item = nil;
}
Yan
  • 3,533
  • 4
  • 24
  • 45