RustBrock/Constants.md

12 lines
368 B
Markdown

# Constants
- Can be declared anywhere,
- The convention to use all caps in a constant's name
- Needs const keyword
- Not always evaluated at compile time (there are rules for this but too complex to know everything)
- Variables can only be assigned once (needs mut to assign more than once (need to be same type))
```rust
const SECONDS_PER_HOUR: i32 = 60 * 60;
```