Skip to content

Instantly share code, notes, and snippets.

@nikolaydubina
Created December 22, 2022 15:46
Show Gist options
  • Save nikolaydubina/39ef989a54f26ffbfd73a0d63496c9e5 to your computer and use it in GitHub Desktop.
Save nikolaydubina/39ef989a54f26ffbfd73a0d63496c9e5 to your computer and use it in GitHub Desktop.
// 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