Created
March 15, 2018 20:00
-
-
Save wurmr/19dd79b513e36d70946b6ad743233700 to your computer and use it in GitHub Desktop.
Rust variable shadowing, why?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let foo = 3; | |
println!("{}", foo); | |
let foo = "hi"; | |
println!("{}", foo); | |
let mut foo = 2.3; | |
println!("{}", foo); | |
foo = "this string will break, foo is a floating-point" | |
println!("{}", foo); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment