Added origin of scoping rules

This commit is contained in:
Denton Liu 2016-05-12 09:59:29 -04:00
parent 50eb3b8f8f
commit 7b6fd013a4

View File

@ -148,6 +148,7 @@ Scoping and Declarations
.. index:: ! scoping, ! declarations
In Solidity, a variable declared anywhere within a function will be in scope for the *entire function*, regardless of where it is declared.
This happens because Solidity inherits its scoping rules from JavaScript.
This is in contrast to many languages where variables are only scoped where they are declared until the end of the semantic block.
As a result, the following code is illegal and cause the compiler to throw an error, `Identifier already declared.`::