News for hackers. Stuff that matters.
Re:Why is zero plural? (2024) by hyrix on Tuesday January 21, 2025 @09:04PM (#42787955)
The answer is obviously because programmers want to be able to write

  f”{n} result{‘s’ if n == 1 else ‘’}”
Re:Why is zero plural? (2024) by thfuran on Tuesday January 21, 2025 @09:41PM (#42788284)
Then they had best steer well clear of Poland.
Re:Why is zero plural? (2024) by remram on Tuesday January 21, 2025 @09:34PM (#42788229)
> f"{n} result{'s' if n == 1 else ''}"

n>1 is even shorter than n!=1

(also you wrote == instead of != your code is backwards)

Re:Why is zero plural? (2024) by antiframe on Tuesday January 21, 2025 @10:00PM (#42788432)
But the whole point is that "0 result" is not correct but "0 results" is.
Re:Why is zero plural? (2024) by remram on Friday January 24, 2025 @10:21AM (#42813927)
The question is why is "0 results" correct. hyrix's answer is so that you have a simple equation for plural, my response is that if "0 result" was correct we would have an even simpler equation.
Re:Why is zero plural? (2024) by DonHopkins on Wednesday January 22, 2025 @01:06AM (#42789561)
That makes -infinity ... -1 singular too.
Re:Why is zero plural? (2024) by isodev on Wednesday January 22, 2025 @12:29AM (#42789345)
Must be the same programmers that make it impossible for me to sign into places with all the diacritics in my name.