From 5f9c02c6b6e78ec80a5b8c2e6a467bb89b9a9454 Mon Sep 17 00:00:00 2001 From: Joshua Hannan Date: Sat, 29 Jul 2017 18:15:54 -0500 Subject: added while loop description --- docs/assembly.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs') diff --git a/docs/assembly.rst b/docs/assembly.rst index 4e665b7e..a56e9cc1 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -545,6 +545,21 @@ The following example computes the sum of an area in memory. } } +With the for loop header, it is also possible to declare it so it behaves +like a while loop. Simply leave the initialization and post-iteration +parts empty. + +.. code:: + + { + let x := 0 + let i := 0 + for { } lt(i, 0x100) { } { // while(i < 0x100) + x := add(x, mload(i)) + i := add(i, 0x20) + } + } + Functions --------- -- cgit v1.2.3 From a73fb4d52957317cd341ad1a126ce3a499889d7b Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 31 Jul 2017 11:44:35 +0200 Subject: Wording. --- docs/assembly.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/assembly.rst b/docs/assembly.rst index a56e9cc1..a7cddb18 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -545,9 +545,8 @@ The following example computes the sum of an area in memory. } } -With the for loop header, it is also possible to declare it so it behaves -like a while loop. Simply leave the initialization and post-iteration -parts empty. +For loops can also be written so that they behave like while loops: +Simply leave the initialization and post-iteration parts empty. .. code:: -- cgit v1.2.3