aboutsummaryrefslogtreecommitdiffstats
path: root/docs/frequently-asked-questions.rst
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2018-06-18 21:58:10 +0800
committerChristian Parpart <christian@ethereum.org>2018-07-03 16:53:09 +0800
commit133fbdbf1874da9bc6b5911430f34a30ccf8db1f (patch)
tree784288777ed6af5f7007a259bf92aa352caa173c /docs/frequently-asked-questions.rst
parent1486d215b9c7f94831784ded50342897b65477c9 (diff)
downloaddexon-solidity-133fbdbf1874da9bc6b5911430f34a30ccf8db1f.tar.gz
dexon-solidity-133fbdbf1874da9bc6b5911430f34a30ccf8db1f.tar.zst
dexon-solidity-133fbdbf1874da9bc6b5911430f34a30ccf8db1f.zip
documentation: adjustments to not use the "var" keyword
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r--docs/frequently-asked-questions.rst9
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>`_.