tutorial: Add a few words about shadowing
This commit is contained in:
parent
4083e8518d
commit
f5db5656ba
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user