C++ or Keyword
Example
The or keyword gives the same result as the || operator:
int x = 5;
cout << (x < 3 || x > 4) << "\n";
cout << (x < 3 or x > 4);
Definition and Usage
The or keyword is another way to write the logical || (or) operator. It returns true (1) if at least one of the conditions is true. In the example above, x < 3 is false, but x > 4 is true, so the result is true (1).
Both ways work the same, but || is much more common.
Related Pages
Read more about logical operators in our C++ Logical Operators Tutorial.