This commit is contained in:
Tahinli 2023-04-12 03:57:11 +03:00
parent a9dc0fc610
commit 63607bf7a2
6 changed files with 0 additions and 0 deletions

23
3-variables/src/main.rs Normal file
View file

@ -0,0 +1,23 @@
fn main() {
println!("Hello, world!");
let mut x = 5;
println!("X = {x}");
x = 6;
println!("X = {x}");
let shadowed = 5;
let shadowed = shadowed + 2; //overshadow
{
let shadowed = shadowed + 13; //overshadow in scope
println!("Shadowed in this scope is = {shadowed}");
}
println!("Shadowed in there is = {shadowed}");
let str = "Hello There";
println!("Str = {}", str);
let str = str.len(); //overshadow with different type
println!("Str = {}", str);
}