Bitwise OR

suggest change

The | operator will perform a binary “or,” where a bit is copied if it exists in either operand. That means:

# 0 | 0 = 0
# 0 | 1 = 1 
# 1 | 0 = 1
# 1 | 1 = 1

# 60 = 0b111100 
# 30 = 0b011110
60 | 30
# Out: 62
# 62 = 0b111110

bin(60 | 30)
# Out: 0b111110

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents