mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Removed unnecessary period
This commit is contained in:
parent
7b6fd013a4
commit
20cec07b46
@ -150,7 +150,7 @@ Scoping and Declarations
|
|||||||
In Solidity, a variable declared anywhere within a function will be in scope for the *entire function*, regardless of where it is declared.
|
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 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.
|
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.`::
|
As a result, the following code is illegal and cause the compiler to throw an error, `Identifier already declared`::
|
||||||
|
|
||||||
contract ScopingErrors {
|
contract ScopingErrors {
|
||||||
function scoping() {
|
function scoping() {
|
||||||
@ -185,7 +185,7 @@ As a result, the following code is illegal and cause the compiler to throw an er
|
|||||||
}
|
}
|
||||||
|
|
||||||
In addition to this, if a variable is declared, it will be initialized at the beginning of the function to its default value.
|
In addition to this, if a variable is declared, it will be initialized at the beginning of the function to its default value.
|
||||||
As a result, the following code is legal, despite being poorly written.::
|
As a result, the following code is legal, despite being poorly written::
|
||||||
|
|
||||||
function foo() returns (uint) {
|
function foo() returns (uint) {
|
||||||
// baz is implicitly initialized as 0
|
// baz is implicitly initialized as 0
|
||||||
|
Loading…
Reference in New Issue
Block a user