Variables, Again

We'll cover the following...

One common purpose for variables is to provide a convenient name to refer to values. For example, take this program:

Press + to interact
fn main() {
println!(
"In the year {}, you'll turn {} if you're born in {}",
2020,
2020 - 1985,
1985,
);
}

We’ve used the numbers 2020 and 1985 twice each, and we have an expression 2020 - 1985 ...

Access this course and 1400+ top-rated courses and projects.