From 6319a3fd067ace2cce7a22902cdc960e3df834ea Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Thu, 12 Jul 2018 14:49:49 +0200 Subject: 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 --- docs/frequently-asked-questions.rst | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'docs/frequently-asked-questions.rst') 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 `_), 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 `_. - 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 `_. -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 `_. - 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? ======================================================================================================================================================================== -- cgit