I'm writing a single command line program in Objective-C after writing it in Java. In one sentence I need to change a word depending on a number, if the number is 1, the word must be in singular otherwise, it should be in plural. In Java I can do that with
System.out.println"Hello" + (num = 1 ? "singular" : "plural");
How can I do something similar in Objective-C?
You can use the same exact trick in Objective C:
NSLog(@"Hello %@", num == 1 ? @"singular" : @"plural");