brentoboy - 2005-03-19

I cant help but admit that c and java win the "best for statement" award.  The BASIC syntax is just not as flexible.

Even though it has a learning curve, and it doest read very intuitively to newbies, it is just too powerful to compromise it for readability.

So, I was thinking...
For (x = 15; x >= 2; x-=2)
  ...
End For
Would work nicely, but alas, it uses symbols in ways that dont "tell the story" and we want APe to read like English. We want newbies to be able to read our code and be able to make an educated guess about what it is doing without cracking open the manual...

So, I was thinking this might be better... I know, I am really ticking some people off by suggesting it, but please comment on it...

For x = I5 While x >= 2 Step x -= 2

End For

of course, if you declare a variable as part of the For clause, then it has loop scope, and goes out of scope when you exit the loop.

you could do it like so:

For Int x = 15 While x >= 2 Step x -=2
  ...
End For

and you could concatenate statements inside of the For or Step portions of the statement by putting that part in parenthesis and separating the substatements with a : (the same symbol you use to combine 2 statements on one line)

For (Int x = 15, j = 7: Float k =1) While (i > j > k) Step (x++: j+=2: k*=2)
 
End For

How gross is that? am I on to something, or have I gone overboard?