aboutsummaryrefslogtreecommitdiffstats
path: root/docs/frequently-asked-questions.rst
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-09 21:36:00 +0800
committerchriseth <chris@ethereum.org>2018-08-14 21:50:46 +0800
commit6cf299bec6b89b22d97e39d7db54f9dc4f652cfb (patch)
treec68420316cbbfb30522a13a5aeae7c716ea49d1a /docs/frequently-asked-questions.rst
parentf873389c6227d41dbba9ba4c23ed055f286ecb71 (diff)
downloaddexon-solidity-6cf299bec6b89b22d97e39d7db54f9dc4f652cfb.tar.gz
dexon-solidity-6cf299bec6b89b22d97e39d7db54f9dc4f652cfb.tar.zst
dexon-solidity-6cf299bec6b89b22d97e39d7db54f9dc4f652cfb.zip
Update documentation examples.
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r--docs/frequently-asked-questions.rst13
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst
index 786c3341..b26ff527 100644
--- a/docs/frequently-asked-questions.rst
+++ b/docs/frequently-asked-questions.rst
@@ -62,7 +62,8 @@ Example::
contract C {
function f() public pure returns (uint8[5] memory) {
string[4] memory adaArr = ["This", "is", "an", "array"];
- return ([1, 2, 3, 4, 5]);
+ adaArr[0] = "That";
+ return [1, 2, 3, 4, 5];
}
}
@@ -186,9 +187,10 @@ If you do not want to throw, you can return a pair::
function checkCounter(uint index) public view {
(uint counter, bool error) = getCounter(index);
if (error) {
- // ...
+ // Handle the error
} else {
- // ...
+ // Do something with counter.
+ require(counter > 7, "Invalid counter value");
}
}
}
@@ -372,15 +374,14 @@ contract level) with ``arrayname.length = <some new length>;``. If you get the
::
- // This will not compile
-
pragma solidity ^0.4.18;
+ // This will not compile
contract C {
int8[] dynamicStorageArray;
int8[5] fixedStorageArray;
- function f() {
+ function f() public {
int8[] memory memArr; // Case 1
memArr.length++; // illegal