Tour of Rust Table of Contents


Variables are declared using the let keyword.

When assigning a value, Rust will be able to infer the type of your variable 99% of the time. If it cannot you may add the type to your variable declaration.

Notice how we can assign to the same variable name multiple times. This is called variable shadowing and the type can be changed for subsequent references to that name.

Variable names are always in snake_case.