Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
The logical OR symbol is a conditional operator used between two different statements to test the validity of each statement. A true result is delivered only when one or both statements are true.
The logical OR operator is used in conditions where an operation may have one false statement. In programming languages, the logical OR operator is often represented by a single or two vertical dashes (||) placed between test expressions.
The logical OR symbol is part of the Boolean algebra family and is frequently used in programming languages where two or more statements are operated to determine a condition type.
What is important to appreciate about the OR statement is that it is one of the most fundamental, primitive conditions available. An OR statement along with the conditional AND statement form the basis of most all computing and electronic circuitry.
A programming language often provides two distinct operators to distinguish bitwise and logical OR operations. In C programming language, the bitwise OR operation uses a single vertical dash (|), whereas the logical OR operation uses double vertical dashes. The logical OR operation uses short circuiting. Thus, if the left operand evaluates as false, the result will be false and the right operand will not be evaluated.