[ANY] Singular and Plural
I've seen lots of if statements because of this very problem. Here is an easy solution:
PHP Code:
|
Re: [ANY] Singular and Plural
For anyone interested in learning more on how to use this in other situations it is called a ternary operator:
https://en.wikipedia.org/wiki/%3F:#Usage |
Re: [ANY] Singular and Plural
I love ternary operators. My recent discovery of how they work (the ternary operator being the ? symbol) has given me so many ways compressing small if statements like the one Totenfluch provided.
:D |
Re: [ANY] Singular and Plural
Code:
// Evaluates to a string of the ordinal suffix of a number (1st, 2nd, 3rd, etc) |
Re: [ANY] Singular and Plural
Quote:
Also, I challenge you to break the all down part by part and explain what each thing means and does :P |
Re: [ANY] Singular and Plural
Quote:
Instead of going into macro, modulo, and ternary hell, try something untested like this: PHP Code:
|
Re: [ANY] Singular and Plural
Ternary operators are usefull but can make code difficult to read.
|
Re: [ANY] Singular and Plural
You can make a translations phrase for single and plural.
Not all languages express plural the same |
Re: [ANY] Singular and Plural
Quote:
|
Re: [ANY] Singular and Plural
It was funny when I made a bool for gender
And then realized that army tanks are an "it". |
All times are GMT -4. The time now is 03:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.