Page 1 of 1
Step in For loop to accept an expression
Posted: Thu Feb 21, 2008 6:25 am
by Mistrel
I'd like to see step For/Next loops accept an expression or at least a variable. The step value isn't always a constant.
Posted: Thu Feb 21, 2008 6:36 am
by va!n
requested x times in the past... please use the forum search. thx
Posted: Thu Feb 21, 2008 6:42 am
by Kaeru Gaman
in For loops the Step is always a constant.
use While or Repeat if you need a variable.
Posted: Thu Feb 21, 2008 10:08 am
by Dare
+1
(Btw, there are any number of syntactical constructs for "for" loops and some of these appear to allow variables as step.
Some do not even use the keyword "for" but are "for" loops as we know them. And some even appear to give a list of values for the step.
So, to nitpick, I think step does not always have to be a constant, that is, there is not some legal or physical or religious law that governs this.

)
Posted: Thu Feb 21, 2008 1:07 pm
by Kaeru Gaman
sure, but in PB it is, like the Loopcounter has to be a Long, which is also uncommon in most other BASIC dialects.
the For-Loop in PB is a Bloody simple Loop, maybe for performance reasons, maybe because it's a stepchild.
anyhow, I think there are tons of more important improvements to do than pimping up the "stepchild"-Loop....
Posted: Thu Feb 21, 2008 3:16 pm
by Dare
Kaeru Gaman wrote:anyhow, I think there are tons of more important improvements to do than pimping up the "stepchild"-Loop....
True.