What is the difference between "||" and "or"?
a = false || true;
b = false or true;
What is the difference between "||" and "or"?
a = false || true;
b = false or true;
there are no difference, see https://en.cppreference.com/w/cpp/keyword/or
sometime (question of taste) may enforce readability (no confusion with |)
There are a group of alternative tokens specified in the standard(a), which equate to primary tokens. One of these is or
for the ||
token.
As per C++11/14 2.6 Alternative tokens
and C++17/20 5.5 Alternative tokens
(wording has remained the same across all these iterations of the standard):
In all respects of the language, each alternative token behaves the same, respectively, as its primary token, except for its spelling.
That's my emphasis to indicate that there is no real difference at all.
(a) As of C++17 (the most recent accepted standard at the time of this answer), the list of alternative tokens and their primaries is:
Alt Prim Alt Prim Alt Prim
--- ---- --- ---- --- ----
<% { and && and_eq &=
%> } bitor | or_eq |=
<: [ or || xor_eq ^=
:> ] xor ^ not !
%: # compl ~ not_eq !=
%:%: ## bitand &
No difference at all. or
is simply an alternative keyword for ||
.
See also https://en.cppreference.com/w/cpp/language/operator_alternative