From f5db5656ba76ff5e88e676b58a2f3659089c0739 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 7 Jul 2012 18:00:16 -0700 Subject: [PATCH] tutorial: Add a few words about shadowing --- doc/tutorial.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/tutorial.md b/doc/tutorial.md index 437f07830c3..e0eba9b8681 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -380,6 +380,14 @@ fn main() { } ~~~~ +Local variables may shadow earlier declarations, causing the +previous variable to go out of scope. + +~~~~ +let my_favorite_value: float = 57.8; +let my_favorite_value: int = my_favorite_value as int; +~~~~ + ## Types The `-> bool` in the `is_four` example is the way a function's return