- 1

what does it mean || ??

28th Nov 2016, 9:28 PM
sara
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.
28th Nov 2016, 9:36 PM
Yasser Kaddoura
Yasser Kaddoura - avatar
+ 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.
28th Nov 2016, 9:46 PM
Jacques Navarro
Jacques Navarro - avatar
+ 1
it means logical expression "or".
28th Nov 2016, 9:29 PM
parisa
parisa - avatar
+ 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/
29th Nov 2016, 1:45 AM
Jacques Navarro
Jacques Navarro - avatar
+ 1
29th Nov 2016, 3:33 AM
Frestien
Frestien - avatar