To make my point about what I am about to propose, first look at each construct to see if its obvious enough what each would mean:
1 2 3 4 5 6 7 8 9 10 11 12 13
| for { ... }
for(test) { ... }
for(init; test; next) { ... }
for(var : a, b) { ... }
for(var : a, b, i) { ... }
for(var : arr) { ... }
for(num) { ... } |
What I am proposing is to just use "for" for every kind of loop ("loop" didn't look as good, and "repeat" feels like the weird cousin of "while"). The idea is that there are fewer keywords, and the context would be easy enough anyway. The answers are (smashed together here so that people can guess first):
while(true) { ... }
while(test) { ... }
init; while(test) { ... next; }
for(var = a; var < b; var++) { ... }
for(var = a; var < b; var += i) { ... }
for(ix = 0; ix < size; ix++) { var = arr[ix]; ... }
for(blah = number; blah > 0; blah--) { ... } // uses DJNZ
Of course, I could throw out the last one if that's going a bit far (and I'd probably implement some of these only once everything else is in place), but I wanted to include several examples to make my point
...Opinions on this? (i.e. instead of having while/until/etc.)