please solve the step barrier with for/next loops

Everything else that doesn't fall into one of the other PB categories.
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

please solve the step barrier with for/next loops

Post by Ralf »

hi fred!
i am writing a small app where the user can type in a number between 1 and 512! i need this number as step variable and because of more overview (readable) i dont want use insisde the for/next loop something like i+64 or something this :?

will you solve this barrier with the next update? would be nice if pure check something like:

lUsersValue = 128
For i = 0 to 1024 Step lUsersValue

thanks!
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

In the mean time shouldn't this work?

NOT TESTED!

Code: Select all

lUsersValue = 128
For i = 0 to (1024/lUsersValue)
Obviously inside the loop you have to do a i*lUsersValue though!
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Post by Ralf »

Rescator wrote:In the mean time shouldn't this work?

NOT TESTED!

Code: Select all

lUsersValue = 128
For i = 0 to (1024/lUsersValue)
Obviously inside the loop you have to do a i*lUsersValue though!
hi! sorry, if i explained it wrong!?
i mean the third value (step value)...

your example just change the expression2 and the step will still be always 1!


For <variable> = <expression1> To <expression2> [Step <constant>]

FOR i = 0 TO 1024 STEP 64 (the 64 must be constand instead a var!
:shock:
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Code: Select all

FOR i = 0 TO 1024 STEP 64
is the same as

Code: Select all

FOR i = 0 TO (1024/64)
that is the same as

Code: Select all

stepvar=64
FOR i = 0 TO (1024/stepvar)
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

@TF
Please test this then :wink:

Code: Select all

For i = 0 To 1024 Step 64
Debug i
Next

Code: Select all

For i = 0 To (1024/64)
Debug i
Next
I is not the same

Henrik
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

sorry my fault :)
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Post by Ralf »

thefool wrote:sorry my fault :)
hehe, no prob men :)
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Re: please solve the step barrier with for/next loops

Post by Doobrey »

Code: Select all

i.l=0
Repeat
 <your code>
  i+lUsersValue
Until i>1024
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

or for now:

amount=1024/stepAmount
for i=0 to amount
index=i*stepAmount
next
Post Reply