Created
December 22, 2022 15:46
-
-
Save nikolaydubina/39ef989a54f26ffbfd73a0d63496c9e5 to your computer and use it in GitHub Desktop.
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
// https://google.github.io/comprehensive-rust/basic-syntax/scopes-shadowing.html | |
fn main() { | |
let a = 10; | |
println!("before: {a}"); | |
{ | |
let a = "hello"; | |
println!("inner scope: {a}"); | |
let a = true; | |
println!("shadowed in inner scope: {a}"); | |
} | |
println!("after: {a}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment