static void Main(string[] args) { var isTrue = false; //Gives a compiler error in C# 8 or lower. Both sides of the expression should be of the same type Pet pet = isTrue ? new Cat() : new Dog(); Console.WriteLine("Hello World!"); }