Diferencia entre revisiones de «or»

De ArduWiki
Saltar a: navegación, buscar
(Ejemplo)
(Vea también)
Línea 35: Línea 35:
  
 
== Vea también ==
 
== Vea también ==
* [[not]]
+
* [[not]] <nowiki>(!)</nowiki>
* [[and]]
+
* [[and]] <nowiki>(&&)</nowiki>
* [[xor]]
+
* [[xor]] <nowiki>(^)</nowiki>
* [[not bit a bit]]
+
* [[not bit a bit]] <nowiki>(~)</nowiki>
* [[and bit a bit]]
+
* [[and bit a bit]] <nowiki>(&)</nowiki>
* [[or bit a bit]]
+
* [[or bit a bit]] <nowiki>(|)</nowiki>
* [[xor bit a bit]]
+
* [[xor bit a bit]] <nowiki>(^)</nowiki>
  
 
== Referencias ==
 
== Referencias ==

Revisión del 09:17 23 jul 2018

Descripción

Es un operador boleano or || que permite unir dos expresiones lógicas de manera disyuntiva ("o"). Sus posibles resultados son dados por la siguiente tabla de verdad:

a b a || b
0 0 0
1 0 1
0 1 1
1 1 1

Sintaxis

espresion 1 || expresion 2

Retorna

Verdadero o falso.

Advertencias

  • No confundir el operador boleano or ||, con el operador or bit a bit |.

Ejemplo

if (x  9 || x  20){
   //Esta entre 10 y 19
}else{
   //Esta fuera del rango
}

Vea también

Referencias