summaryrefslogtreecommitdiffstats
path: root/src/shadowing
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.cc>2026-10-03 04:40:21 +0300
committerhybrid <hybrid@hybridlabs.cc>2026-10-03 04:40:21 +0300
commitf6cbf2bf76e77c8f64312f573f46cdc7bd434acd (patch)
treee1798d4d8533fcbfcda2b269ddf5494147466633 /src/shadowing
parentd13f336198c40abacff6996f118040ae73dfbb30 (diff)
downloadrust-book-f6cbf2bf76e77c8f64312f573f46cdc7bd434acd.tar.gz
rust-book-f6cbf2bf76e77c8f64312f573f46cdc7bd434acd.tar.bz2
rust-book-f6cbf2bf76e77c8f64312f573f46cdc7bd434acd.zip
add: 8 projects
variables, shadowing, another_function, branches, loops, fahr2cel, fibonacci, christmax_song
Diffstat (limited to 'src/shadowing')
-rw-r--r--src/shadowing/Cargo.toml6
-rw-r--r--src/shadowing/src/main.rs12
2 files changed, 18 insertions, 0 deletions
diff --git a/src/shadowing/Cargo.toml b/src/shadowing/Cargo.toml
new file mode 100644
index 0000000..23403b4
--- /dev/null
+++ b/src/shadowing/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "shadowing"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
diff --git a/src/shadowing/src/main.rs b/src/shadowing/src/main.rs
new file mode 100644
index 0000000..03924fe
--- /dev/null
+++ b/src/shadowing/src/main.rs
@@ -0,0 +1,12 @@
+fn main() {
+ let x = 5;
+
+ let x = x + 1;
+
+ {
+ let x = x * 2;
+ println!("The value of x in the inner scope is: {x}");
+ }
+
+ println!("The value of x is: {x}");
+}