Nos permiten trabajar con valores booleanos (True y False).
PragamacionEstructurada
Operadores Lógicos
and
Evalúa si el operando izquierdo y el derecho son verdaderos.
(5 > 6) and (6 > 8)
False
X | Y | X and Y |
True | True | True |
True | False | False |
False | True | False |
False | False | False |
or
Nos permite conectar dos expresiones y compararlas.
(5 > 6) or (6 > 8)
False
X | Y | X or Y |
True | True | True |
True | False | True |
False | True | True |
False | False | False |
not
No, en español.
not True
False
not False
True
X | not X |
True | False |
False | True |
Prioridad operadores lógicos
De mayor a menor
- not
- and
- or
Obra publicada con Licencia Creative Commons Reconocimiento Compartir igual 4.0