rustlings/exercises/variables/variables5.rs
Andrew Dobrych f8e766bc66 exercises
2021-08-11 11:21:01 +01:00

15 lines
661 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// variables5.rs
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
// Exercise explanation
//you can declare a new variable with the same name as a previous variable.
// Rustaceans say that the first variable is shadowed by the second, which means that the second variables value is what appears when the variable is used.
// We can shadow a variable by using the same variables name and repeating the use of the let keyword
fn main() {
let number = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number);
let number = 3;
println!("Number plus two is : {}", number + 2);
}