1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-14 18:55:00 +02:00

[python3/en] Bool operators

Bool operators
This commit is contained in:
Steven Basart
2014-09-07 19:23:07 -04:00
parent 62f4c0de22
commit 820eebcd33

View File

@@ -66,11 +66,12 @@ not False # => True
True and False #=> False True and False #=> False
False or True #=> True False or True #=> True
# Note with ints # Note using Bool operators with ints
0 and 2 #=> 0 0 and 2 #=> 0
-5 or 0 #=> -5 -5 or 0 #=> -5
0 == False #=> True 0 == False #=> True
2 == True #=> False #only 1 == True #=> True 2 == True #=> False
1 == True #=> True
# Equality is == # Equality is ==
1 == 1 # => True 1 == 1 # => True