Wednesday 15 September 2010

java - Is there a one-liner for dealing with singular/plural words in common languages? -


I often see that websites work like 1 idea, 1 day balance or 1 answer. It's just lazy to me because it's easy to set up often:

  if (view == 1) print view + "view" and print idea + "idea"   

I want to know if Java, Python, PHP, etc. have a liner in the same language, then there is something I can comment on those who do this and say, its easy Is it possible to add it to your code?

While using it on my site, it seems that many C-based programming languages Ternary supports operators. It's as easy as PHP:

  & lt ;? = $ View 'Roy' ($ View == 1? '': 'S'); ? & Gt;    

No comments:

Post a Comment