diff options
author | Denton Liu <liu.denton+github@gmail.com> | 2016-05-12 21:59:29 +0800 |
---|---|---|
committer | Denton Liu <liu.denton+github@gmail.com> | 2016-05-12 21:59:29 +0800 |
commit | 7b6fd013a473e93f1f9381de19e83c06697af10c (patch) | |
tree | d514e662f9f283021ba9366419c0e6e73a2e9f73 | |
parent | 50eb3b8f8f8679e4508ae0da741af65f8cd4a263 (diff) | |
download | dexon-solidity-7b6fd013a473e93f1f9381de19e83c06697af10c.tar.gz dexon-solidity-7b6fd013a473e93f1f9381de19e83c06697af10c.tar.zst dexon-solidity-7b6fd013a473e93f1f9381de19e83c06697af10c.zip |
Added origin of scoping rules
-rw-r--r-- | docs/control-structures.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 3e766b5c..0e74c589 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -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.`:: |