mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Incorporate changes
This commit is contained in:
parent
14f57568dc
commit
cf0579a86e
@ -154,11 +154,10 @@ Scoping and Declarations
|
||||
========================
|
||||
|
||||
A variable which is declared will have an initial default value whose byte-representation is all zeros.
|
||||
This is because the EVM must run without undefined behaviour so it would be inappropriate to initialize any variables to random garbage values.
|
||||
The "default values" of variables are the typical "zero-state" of whatever the type is. For example, the default value for a ``bool``
|
||||
is ``false``. The default value for the ``uint`` or ``int`` types is ``0``. For statically-sized arrays and ``bytes1`` to ``bytes32``, each individual
|
||||
element will be initialized to the default value corresponding to its type. Finally, for dynamically-sized arrays, ``bytes``
|
||||
and ``string``, the default value is an empty array or a zero-length member of its respective type.
|
||||
and ``string``, the default value is an empty array or string.
|
||||
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user