eolas/zk/Bitwise_operators.md
2024-04-20 15:10:04 +01:00

30 lines
728 B
Markdown

---
id: t127
title: Bitwise_operators
tags: [binary]
created: Saturday, April 20, 2024
---
# Bitwise operators
In addition to mathematical, logical and comparison operators, there are
_bitwise operators_. These operators execute conditions based on the actual bits
of a value rather than the values that the bits are encoded to represent.
Bitwise operators are typically represented with single characters of existing
operators, e.g. `&` instead of `&&`:
| Bitwise operation | Operator |
| ----------------- | ------------- |
| AND | `&` |
| OR | (single pipe) |
| NOT | `~` |
An example of using the `&` operator:
```py
x =5
y = 3
```
## Related notes