You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...assigning to a local variable creates an independent copy only for elementary types, i.e. static types that fit into 32 bytes
is this correct?
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.
Internally, Solidity performs a revert operation (instruction 0xfd) for a require-style exception and executes an invalid operation (instruction 0xfe) to throw an assert-style exception. In both cases, this causes the EVM to revert all changes made to the state. The reason for reverting is that there is no safe way to continue execution, because an expected effect did not occur. Because we want to retain the atomicity of transactions, the safest thing to do is to revert all changes and make the whole transaction (or at least call) without effect. Note that assert-style exceptions consume all gas available to the call, while require-style exceptions will not consume any gas starting from the Metropolis release.
contract C {
function foo() public pure returns (uint) {
// baz is implicitly initialized as 0
uint bar = 5;
if (true) {
bar += baz;
} else {
uint baz = 10;// never executes
}
return bar;// returns 5
}
}
1. Sections of code which does not compile:
Internal function calls
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#internal-function-calls
External function calls
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#external-function-calls
Crating contracts via
new
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#creating-contracts-via-new
A: Keyword
new
is not supported in ArrayDestructuring ssignments and returning multiple values
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#destructuring-assignments-and-returning-multiple-values
-Scoping and Declarations: second set of code
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#scoping-and-declarations
A: most likely because
baz
is not implicitly initialized as zero.https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#scoping-starting-from-version-050
A: we don't support pragma 0.5.0
2. Questions:
Do we support
.value()
?https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#creating-contracts-via-new
In Complications for Arrays and Structs:
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#complications-for-arrays-and-structs
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#error-handling-assert-require-revert-and-exceptions
3. Errors:
a) Scoping and Declarations: second set of code
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#scoping-and-declarations
A: ERROR: IfStatement_id(17): cannot get oparg1
b) Error handling assert require revert and exceptions
https://github.com/arrayio/array-io-solidity/blob/master/control-structures.rst#error-handling-assert-require-revert-and-exceptions
A: Throw doesn't work but it's depricated ERROR: Block_id(11): unknown "Throw
assert
andrequire
do work, butthis.balance
is not supportedThe text was updated successfully, but these errors were encountered: