The singular if num is 1 or -1, otherwise the plural.
string one = 1.plurality("one", "two"); string two = 2.plurality("one", "two"); string many = (-2).plurality("one", "many"); string many0 = 0.plurality("one", "many"); assert((one == "one"), one); assert((two == "two"), two); assert((many == "many"), many); assert((many0 == "many"), many0);
static assert(10.plurality("one","many") == "many"); static assert(1.plurality("one", "many") == "one"); static assert((-1).plurality("one", "many") == "one"); static assert(0.plurality("one", "many") == "many");
Selects the correct singular or plural form of a word depending on the numerical count of it.
Technically works with any type provided the number is some comparable integral.