objective c - NSLog - Write word in singular if condition is met -
i'm writing single command line program in objective-c after writing in java. in 1 sentence need change word depending on number, if number 1, word must in singular otherwise, should in plural. in java can
system.out.println"hello" + (num = 1 ? "singular" : "plural");
how can similar in objective-c?
you can use same exact trick in objective c:
nslog(@"hello %@", num == 1 ? @"singular" : @"plural");
Comments
Post a Comment