CSharp · Console
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("\n --- For REGULAR NOUNS --- \n");
{
int count1 = 1;
Console.WriteLine($"I have {count1} apple{(count1 == 1 ? "" : "s")}.");
int count2 = 5;
Console.WriteLine($"I have {count2} apple{(count2 == 1 ? "" : "s")}.");
}
Console.WriteLine("\n --- For IRREGULAR NOUNS --- \n");
{
int count1 = 1;
Console.WriteLine($"He has {count1} {(count1 == 1 ? "leaf" : "leaves")}.");
int count2 = 5;
Console.WriteLine($"He has {count2} {(count2 == 1 ? "leaf" : "leaves")}.");
}
//Reference: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/interpolated-strings
}
}