mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-07-07 11:37:13 -06:00
tried out obsidian, started ch 6.2
This commit is contained in:
11
Constants.md
Normal file
11
Constants.md
Normal file
@ -0,0 +1,11 @@
|
||||
# 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;
|
||||
```
|
Reference in New Issue
Block a user