mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2664 from joshuahannan/develop
added while loop description
This commit is contained in:
commit
2fa59489b6
@ -570,6 +570,20 @@ The following example computes the sum of an area in memory.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
For loops can also be written so that they behave like while loops:
|
||||||
|
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
|
Functions
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user