Rust Notes: Booleans
Published: 7th of February 2022
The boolean type in Rust is defined with the bool type annotation and can be either a true or false literal.
// Assign `true` to the `stuff` variable let stuff = true; // Annotate the `bool` type let things: bool = false;
- false has a bit battern of 0x00
- true has a bit battern of 0x01
- Booleans cannot be used in arithmatic unless they are cast to a u8