|
|
Christopher James Huff <chr### [at] maccom> wrote in news:chrishuff-
A44### [at] netplexaussieorg:
> In article <3d9c22b8@news.povray.org>, Warp <war### [at] tagpovrayorg>
> wrote:
>
>> > And I've never used the "?:" operator.
>> Why not? It's handy. :)
>
> Never needed it. Expressions using it are much less readable IMO, and
> I've never had a situation where using if...else was significantly
> longer or more awkward.
printf("There is %d object%s\n", objNb, objNb > 1 ? "s" : "");
Alternatives: use two printf (may be better if you need to localize it, some
languages may not use the same plural rules) or an intermediate variable.
I don't like much the "object(s)" syntax when I can avoid it. Even less the
"1 objects" form...
--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
Post a reply to this message
|
|