diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/control-structures.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index fc55f8e6..96768919 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -146,13 +146,13 @@ Complications for Arrays and Structs The semantics of assignment are a bit more complicated for non-value types like arrays and structs. Assigning *to* a state variable always creates an independent copy. On the other hand, assigning to a local variable creates an independent copy only for elementary types, i.e. static types that fit into 32 bytes. If structs or arrays (including ``bytes`` and ``string``) are assigned from a state variable to a local variable, the local variable holds a reference to the original state variable. A second assignment to the local variable does not modify the state but only changes the reference. Assignments to members (or elements) of the local variable *do* change the state. -.. index:: ! exception, ! throw +.. index:: ! scoping, declarations, default value + +.. _default-value: Scoping and Declarations ======================== -.. index:: ! scoping, ! declarations, ! default-value - In Solidity, a variable which is declared is automatically assigned its default value. It will be assigned on contract initialization if it is a contract-level variable or at the beginning of a function call if it is a local variable. This is because the EVM must run deterministically so it would be inappropriate to initialize any variables to random garbage values. @@ -213,6 +213,8 @@ As a result, the following code is legal, despite being poorly written:: return bar;// returns 5 } +.. index:: ! exception, ! throw + Exceptions ========== |