or operator c sharp code example
Example 1: c# or
// The or statement in C# is ||
if (a == b || a == c)
{
// Do something
}
Example 2: || in c#
bool SecondOperand()
{
Console.WriteLine("Second operand is evaluated.");
return true;
}
bool a = true || SecondOperand();
Console.WriteLine(a);
// Output:
// True
bool b = false || SecondOperand();
Console.WriteLine(b);
// Output:
// Second operand is evaluated.
// True