diff options
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r-- | docs/frequently-asked-questions.rst | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index bb00441c..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>`_. |