Step in For loop to accept an expression

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Step in For loop to accept an expression

Post 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.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

requested x times in the past... please use the forum search. thx
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

in For loops the Step is always a constant.
use While or Repeat if you need a variable.
oh... and have a nice day.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post 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. :) )
Dare2 cut down to size
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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....
oh... and have a nice day.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Kaeru Gaman wrote:anyhow, I think there are tons of more important improvements to do than pimping up the "stepchild"-Loop....
:D :wink:

True.
Dare2 cut down to size
Post Reply