Open
Description
There is a bounded loops proposal for BCH.
It would be good to consider the possible syntax this would translate to in CashScript.
The bounded loops construction enables indefinite loops, which can easily emulate definite loops.
From the spec:
Naming and Semantics
This proposal is influenced by the BEGIN ... UNTIL indefinite loop construction in the Forth programming language (upon which the rest of the Bitcoin Cash VM is based). This particular construction offers maximal flexibility: definite loops can be easily emulated with indefinite loops, but indefinite loops cannot be emulated with definite loops.
So there would both be a for
and a while
loop syntax.
I got the solidity syntax for both, I think they're the same as in Javascript:
while (i != 0) {
// do something
}
for (uint i = 1; i <= 5; i++) {
// do something
}