diff options
author | Chris Ward <chriswhward@gmail.com> | 2018-07-12 20:49:49 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-11-12 21:34:09 +0800 |
commit | 6319a3fd067ace2cce7a22902cdc960e3df834ea (patch) | |
tree | 7d7197ad6a783a1277e677f396c7d547d136ae22 /docs/frequently-asked-questions.rst | |
parent | d68dfd2c20b8e04df79bbd1c9c87f9b1323b1fe5 (diff) | |
download | dexon-solidity-6319a3fd067ace2cce7a22902cdc960e3df834ea.tar.gz dexon-solidity-6319a3fd067ace2cce7a22902cdc960e3df834ea.tar.zst dexon-solidity-6319a3fd067ace2cce7a22902cdc960e3df834ea.zip |
Move control structure related FAQ points
Updates from reviews
clarify returning structs, and move returning arrays and strings from separate section
Further clarifications
Updates from review
Final updates
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r-- | docs/frequently-asked-questions.rst | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index 3e9a6aca..8b655b0d 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -38,11 +38,6 @@ has it (which includes `Remix <https://remix.ethereum.org/>`_), then ``contractname.kill.sendTransaction({from:eth.coinbase})``, just the same as my examples. -Can you return an array or a ``string`` from a solidity function call? -====================================================================== - -Yes. See `array_receiver_and_returner.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/60_array_receiver_and_returner.sol>`_. - Is it possible to in-line initialize an array like so: ``string[] myarray = ["a", "b"];`` ========================================================================================= @@ -61,11 +56,6 @@ Example:: } } -Can a contract function return a ``struct``? -============================================ - -Yes, but only in ``internal`` function calls or if ``pragma experimental "ABIEncoderV2";`` is used. - If I return an ``enum``, I only get integer values in web3.js. How to get the named values? =========================================================================================== @@ -103,15 +93,6 @@ How do structs work? See `struct_and_for_loop_tester.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/65_struct_and_for_loop_tester.sol>`_. -How do for loops work? -====================== - -Very similar to JavaScript. Such as the following example: - -``for (uint i = 0; i < a.length; i ++) { a[i] = i; }`` - -See `struct_and_for_loop_tester.sol <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/65_struct_and_for_loop_tester.sol>`_. - What are some examples of basic string manipulation (``substring``, ``indexOf``, ``charAt``, etc)? ================================================================================================== @@ -292,12 +273,6 @@ In this example:: } } -Can a contract function accept a two-dimensional array? -======================================================= - -If you want to pass two-dimensional arrays across non-internal functions, -you most likely need to use ``pragma experimental "ABIEncoderV2";``. - What is the relationship between ``bytes32`` and ``string``? Why is it that ``bytes32 somevar = "stringliteral";`` works and what does the saved 32-byte hex value mean? ======================================================================================================================================================================== |