diff options
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r-- | docs/frequently-asked-questions.rst | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index ca5a1aee..0d6fa033 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -136,14 +136,9 @@ See `struct_and_for_loop_tester.sol <https://github.com/fivedogit/solidity-baby- How do for loops work? ====================== -Very similar to JavaScript. There is one point to watch out for, though: +Very similar to JavaScript. Such as the following example: -If you use ``for (var i = 0; i < a.length; i ++) { a[i] = i; }``, then -the type of ``i`` will be inferred only from ``0``, whose type is ``uint8``. -This means that if ``a`` has more than ``255`` elements, your loop will -not terminate because ``i`` can only hold values up to ``255``. - -Better use ``for (uint i = 0; i < a.length...`` +``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>`_. @@ -426,10 +421,10 @@ In the case of a ``contract A`` calling a new instance of ``contract B``, parent You will need to make sure that you have both contracts aware of each other's presence and that ``contract B`` has a ``payable`` constructor. In this example:: - pragma solidity ^0.4.0; + pragma solidity >0.4.24; contract B { - function B() public payable {} + constructor() public payable {} } contract A { |