Fix example; closes #3582

This commit is contained in:
Aaron Colaço 2018-02-23 23:17:48 +05:30
parent 272262ea99
commit ef7fbf8d0c

View File

@ -542,12 +542,27 @@ contract level) with ``arrayname.length = <some new length>;``. If you get the
:: ::
int8[] memory memArr; // Case 1 // This will not compile
memArr.length++; // illegal
int8[5] storageArr; // Case 2 pragma solidity ^0.4.18;
somearray.length++; // legal
int8[5] storage storageArr2; // Explicit case 2 contract C {
somearray2.length++; // legal int8[] dynamicStorageArray;
int8[5] fixedStorageArray;
function f() {
int8[] memory memArr; // Case 1
memArr.length++; // illegal
int8[5] storage storageArr = fixedStorageArray; // Case 2
storageArr.length++; // illegal
int8[] storage storageArr2 = dynamicStorageArray;
storageArr2.length++; // legal
}
}
**Important note:** In Solidity, array dimensions are declared backwards from the way you **Important note:** In Solidity, array dimensions are declared backwards from the way you
might be used to declaring them in C or Java, but they are access as in might be used to declaring them in C or Java, but they are access as in