Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 23 |
Nodes: | 6 (0 / 6) |
Uptime: | 54:28:37 |
Calls: | 583 |
Files: | 1,139 |
D/L today: |
179 files (27,921K bytes) |
Messages: | 111,799 |
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
Since I'm also doing a lot of text oriented processing[...]
I'm usually using some pluralization, e.g. in "C" like
printf ("Copy %d item%s ...", n, (n>1 ? "s" : "") );
I'd probably write :
printf("Copy %d item%s ...", n, n==1 ? "" : "s");
"Copy 0 items" seems more correct than "Copy 0 item".
On 23/08/2025 17:49, Janis Papanagnou wrote:
Often we stumble across text output from software, like
Copy 42 items (12 minutes left).
...
Copy 1 items (1 minutes left).
Since I'm also doing a lot of text oriented processing
I'm usually using some pluralization, e.g. in "C" like
printf ("Copy %d item%s ...", n, (n>1 ? "s" : "") );
Firstly, I agree with Keith that English uses the
plural in the case n = 0; n < 0 is, I suppose, unlikely to
occur in real examples.
[...]. So instead of inline-ternary operators ?:
or procedures these Algol 68 operator variants emerged:
PRIO PLURAL = 6;
OP PLURAL = (INT amount, STRING word) STRING :
whole (amount, 0) + word + ( amount > 1 | "s" | "" );
Secondly, if you're generalising, then you "should" look
at the end of "word": eg "flies" rather than "flys". I accept,
of course, that there are limits to how much should be done; you
can spend years tweaking stuff like that.
[...]