Static and Constant Variables
You can declare compile-time constants:
You can also declare static variables:
fn main() {
}
We will look at mutating static data in the chapter on Unsafe Rust.
- Mention that
const
behaves semantically similar to C++’s . - It isn’t super common that one would need a runtime evaluated constant, but it is helpful and safer than using a static.