how use this || | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how use this ||

24th Sep 2016, 10:56 AM
sagir
sagir - avatar
3 Answers
+ 1
|| boolean operand OR true || true = true true || false = true false || false = false
1st Oct 2016, 10:19 AM
Margineanu Andrei
Margineanu Andrei - avatar
0
hi, || means the boolean operand OR true OR false = true, true || false = true. when used with one binary bit : 1 or 0 = 1 , 1 || 0 = 1 it is equivalent in electronics : 5V or 0V = 5V , 5V || 0V = 5V it may be compared to an addition operand but it is not, because 1 OR 1 = 1 but 1 + 1 = 10 (binary) so the + operand is called XOR where 1 XOR 1 = 0 true XOR true = false. a OR b ie a || b is equivalent to if either of a or b are true or both are true then the result is true.
24th Sep 2016, 11:56 AM
ADEL MAHJOUB
ADEL MAHJOUB - avatar
0
in jS var a = true, b = false; if(a || b) {code if condition is true}
24th Sep 2016, 11:59 AM
ADEL MAHJOUB
ADEL MAHJOUB - avatar