tutorial: Add a few words about shadowing

This commit is contained in:
Brian Anderson 2012-07-07 18:00:16 -07:00
parent 4083e8518d
commit f5db5656ba

View File

@ -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 ## Types
The `-> bool` in the `is_four` example is the way a function's return The `-> bool` in the `is_four` example is the way a function's return