Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
User Journal

Journal wheany's Journal: My pet peeve(s)

One thing I hate is people using "optional" plurals in programs.

The reasoning must be in the lines of:

  • I'm a lazy bastard and don't want to create two different strings and use something like 'if($num_items != 1) print("you have $num_items items") else print("you have 1 item")'.
  • On the other hand, the user might have 0, 1 or several items.
  • So if I only print "item", the string looks stupid when there are 0 or several items
  • And if I only print "items", the string looks stupid when there is exactly 1 item
  • I know, I'll print "item(s)" that way the string looks stupid every time!

Personally I recommend writing just the plural form. That way the string looks stupid only when there is exactly 1 item. It will look perfectly fine when there are 0, 0.5, 1.25, 100 or 7.12E20 items.

This discussion has been archived. No new comments can be posted.

My pet peeve(s)

Comments Filter:

The hardest part of climbing the ladder of success is getting through the crowd at the bottom.

Working...