305.
What is output of following code : class Program { static bool GetX() { Console.WriteLine("GetX"); return true; } static bool GetY() { Console.WriteLine("GetY"); return false; } static void Main() { Console.WriteLine(GetX() | GetY()); Console.WriteLine(GetX() || GetY()); } }
View Description
short circuit on GetX() || GetY() causes that only first call is executed. The conditional-OR operator (||) performs a logical-OR of its bool operands, but only evaluates its second operand if necessary
For bool operands, | computes the logical OR of its operands; that is, the result is false if and only if both its operands are false