If I have IF condition like:
if(x == 0 || y == 4)
{
// ...
}
then if x == 0
is true does c# checks if y == 4
while we already know the whole expression is true?
If I have IF condition like:
if(x == 0 || y == 4)
{
// ...
}
then if x == 0
is true does c# checks if y == 4
while we already know the whole expression is true?
The conditional-OR operator (||) performs a logical-OR of its bool operands. If the first operand evaluates to true, the second operand isn't evaluated.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-or-operator
Look at MSDN. So the answer is NO, it doesn't check
The conditional-OR operator (||) performs a logical-OR of its bool operands. If the first operand evaluates to true, the second operand isn't evaluated. If the first operand evaluates to false, the second operator determines whether the OR expression as a whole evaluates to true or false.