For .. Step var

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

For .. Step var

Post by KarLKoX »

Code: Select all

nStep = 2
for x = 0 to 10 Step nStep

would be usefull :) (or it is a bug ?)
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
CherokeeStalker
User
User
Posts: 66
Joined: Fri Oct 17, 2003 2:42 am

Re: For .. Step var

Post by CherokeeStalker »

KarLKoX wrote:

Code: Select all

nStep = 2
for x = 0 to 10 Step nStep

would be usefull :) (or it is a bug ?)

You can already do this! See code below ...

x.s = ""
For i = 1 To 31 Step 2
x.s = x.s + Chr(10) + Str(i)
Next
MessageRequester("Info",x.s,0)
x.s = ""
For i = 30 To 0 Step -2
x.s = x.s + Chr(10) + Str(i)
Next
MessageRequester("Info",x.s,0)
End
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

would be usefull (or it is a bug ?)
Its a limitation:
viewtopic.php?t=4930
--Kale

Image
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: For .. Step var

Post by NoahPhense »

KarLKoX wrote:

Code: Select all

nStep = 2
for x = 0 to 10 Step nStep

would be usefull :) (or it is a bug ?)
Needs to be a numberic constant or just a number.

Code: Select all

#nStep = 2 
For x = 0 To 10 Step #nStep 
Debug x
Next x
but yeah.. i guess if one needed to change the stepping during runtime
then it would be quite difficult.
Post Reply