book
book copied to clipboard
Clarify shadowing sentence.
The other difference between mut and shadowing is that because we’re effectively creating a new variable when we use the let keyword again, we can change the type of the value but reuse the same name. For example, say our program asks a user to show how many spaces
It took me a couple of times reading this and the examples below, but I believe the desired conjunction is and here.
On second thought, maybe the intent of the sentence is more to contrast with mut?
Maybe something like:
When using
mutwe lose immutability which is something we not might always want. By usinglet, we can both change the value and type and maintain immutability after our transformations are complete. This also allows us to signal the intent of variable usage.