Tour of Rust Table of Contents


Constants allow us to specify a common value that's used throughout our code many times efficiently. Instead of copying values like variables where they are used, constants directly replace the text identifier where they are used with their value at compile time.

Unlike variables, constants must always have explicit types.

Constant names are always in SCREAMING_SNAKE_CASE.