summaryrefslogtreecommitdiff
path: root/Shadowing variables.md
diff options
context:
space:
mode:
authorJasper Ras <jras@hostnet.nl>2025-08-21 22:09:29 +0200
committerJasper Ras <jras@hostnet.nl>2025-08-21 22:09:29 +0200
commit27514d58573ce1f844af4ea60afa72c7f58f1cd7 (patch)
tree4b16c31f73cb72435d03d5e105261143f8ca135f /Shadowing variables.md
parent22675cd8dc75d8b8d4b0f818f5b093efbc364802 (diff)
vault backup: 2025-08-21 22:09:29HEADmain
Diffstat (limited to 'Shadowing variables.md')
-rw-r--r--Shadowing variables.md2
1 files changed, 0 insertions, 2 deletions
diff --git a/Shadowing variables.md b/Shadowing variables.md
index ce10d66..6ff1d58 100644
--- a/Shadowing variables.md
+++ b/Shadowing variables.md
@@ -1,5 +1,3 @@
-[[Rust]]
-
It is basically redeclaring the same variable, but it can be redeclared with a **different type**. A immutable variable can also be shadowed.
Shadowing is undone when the scope ends, for example in a closure I can shadow a variable from the parent scope, but in the parent scope after the child scope ends we have the original value not the one from the child scope.