- 1
what does it mean || ??
5 Answers
+ 2
It's used between bool expressions and returns true if at least one of them is true. unlike && that only returns true if all of the expressions are true.
+ 2
It's one of the logical operators.
It returns true if one of two conditions are true and false if both conditions are false.
(condition #1 || condition #2)
true || true = true
true || false = true
false || true = true
false || false = false
Example:
(1 > 2 || 10 > 5) equals to true - Atleast one of the contions is true so the result is true
(5 >= 4 || 3 == 2) equals to false - Both conditions are false so the result is false.
Note that you can use any type of comparison.
(100* 20 > 5 || 5 != 4) = true
Edit: typed in too many braces.
+ 1
it means logical expression "or".
+ 1
I typed up an example to show how this operator works. It's probably better to see in action in an if statement.
http://www.sololearn.com/app/sololearn/playground/ce3dh9PbtUKC/
+ 1
it's logical OR https://en.m.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence see the link for more explanation