C++ keyword: or - cppreference.com

From cppreference.com

Usage

alternative operators

: as an alternative for ||

Example

Run this code

#include<iostream>voidshow(boolz,constchar*s,intn){constchar*r{z?" true ":" false "};if(n==0)std::cout<<"┌────────────────┬─────────┐\n";if(n<=2)std::cout<<"│ "<<s<<" │ "<<r<<" │\n";if(n==2)std::cout<<"└────────────────┴─────────┘\n";}intmain(){show(falseorfalse,"false or false",0);show(falseortrue,"false or true ",1);show(trueorfalse,"true or false",1);show(trueortrue,"true or true ",2);}Output:

┌────────────────┬─────────┐ │ false or false │ false │ │ false or true │ true │ │ true or false │ true │ │ true or true │ true │ └────────────────┴─────────┘ See also

and

,

and_eq

bitand

,

bitor

not

,

not_eq

or_eq

xor

,

xor_eq