Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
C# || Operator Reference
C# code - No need to download anything, this code works in your browser
AmieDD www.amiedd.com Code, Cosplay, and Games
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
23
// {
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
// {
Enter to Rename, Shift+Enter to Preview
About C# || Operators
The conditional logical OR operator || calculates the logical OR of its bool operands. The result of x || y is true if either x or y evaluates to true. If not the result is false. If the first operand evaluates to true, the second operand is not evaluated and the result of operation is true.
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content