Page 1 of 1
please solve the step barrier with for/next loops
Posted: Mon Mar 21, 2005 5:40 am
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!
Posted: Mon Mar 21, 2005 6:20 am
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!
Posted: Mon Mar 21, 2005 12:36 pm
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!

Posted: Mon Mar 21, 2005 12:38 pm
by thefool
is the same as
that is the same as
Code: Select all
stepvar=64
FOR i = 0 TO (1024/stepvar)
Posted: Mon Mar 21, 2005 8:27 pm
by Henrik
@TF
Please test this then
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
Posted: Mon Mar 21, 2005 9:26 pm
by thefool
sorry my fault

Posted: Tue Mar 22, 2005 12:34 am
by Ralf
thefool wrote:sorry my fault

hehe, no prob men

Re: please solve the step barrier with for/next loops
Posted: Tue Mar 22, 2005 1:33 am
by Doobrey
Code: Select all
i.l=0
Repeat
<your code>
i+lUsersValue
Until i>1024
Posted: Tue Mar 22, 2005 2:30 am
by dracflamloc
or for now:
amount=1024/stepAmount
for i=0 to amount
index=i*stepAmount
next