Hi !
Now for the STEP in the FOR/NEXT is a constant and Integer !
How to do, if the Step is dependent on a result from the code ? And more, if is not integer ?
As in other language, whether the STEP must be VARIABLE
Maintenant, le PAS dans une boucle FOR/NEXT doit être une constante et de plus entier.
Comment faire si le PAS est dépendant d'un RESULTAT qui peut être décimal = 0.02 ??? Ou autre ?
Dans d'autre language c'est possible... Alors PB non ?
Merci.
STEP Variable !
STEP Variable !
Sorry for my english
! (Windows Xp, Vista and Windows 7, Windows 10)

Re: STEP Variable !
For this case you normally use a While : Wend complex. I never noticed in another language if it is possible, however I wouldnt think its necessary.
pb 5.11
Re: STEP Variable !
GeBonet wrote:Hi !
Now for the STEP in the FOR/NEXT is a constant and Integer !
How to do, if the Step is dependent on a result from the code ? And more, if is not integer ?
As in other language, whether the STEP must be VARIABLE
Code: Select all
myStep.f = 0.2
i.f = 1.0
Repeat
Debug i
;myStep + 0.1 ;variable step
i + myStep
Until i > 10.0
Debug "----"
myStep.f = 0.2
i.f = 1.0
While i <= 10.0
Debug i
;myStep + 0.1 ;variable step
i + myStep
Wend

Last edited by Demivec on Mon Sep 05, 2011 12:35 am, edited 1 time in total.
Re: STEP Variable !
HI !
I Thing you not have understand what i mind !
If i one part of the code give me 0.05 and this value is the STEP for a evolution of the space between 2 limits into one curve...
The sample code :
VariationOffCode=0.05
For i=lowLimit TO Highlimit STEP VariationOffCode
Result(k)=value*sin(angle+i):k+1
next i
Therefore, we need "i" and the value of STEP must be floating or double precision ...
Or it would be easier!
Note : There are obviously other way to get around this, but it would be a bypass, i know this and tanks.
I Thing you not have understand what i mind !
If i one part of the code give me 0.05 and this value is the STEP for a evolution of the space between 2 limits into one curve...
The sample code :
VariationOffCode=0.05
For i=lowLimit TO Highlimit STEP VariationOffCode
Result(k)=value*sin(angle+i):k+1
next i
Therefore, we need "i" and the value of STEP must be floating or double precision ...
Or it would be easier!

Note : There are obviously other way to get around this, but it would be a bypass, i know this and tanks.

Sorry for my english
! (Windows Xp, Vista and Windows 7, Windows 10)

Re: STEP Variable !
swap i and k:
Code: Select all
VariationOffCode.f=0.05
maxk = (Highlimit-lowLimit)/VariationOffCode
i.f = lowLimit
For k=0 To maxk
Result(k)=value*Sin(angle+i) : i+VariationOffCode
Next k
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: STEP Variable !
Thank you, thank you very much
But here it is "Feature Requests and Wishlists" and that's what I want!
Just One for Sample : "For i.f = 2.5 to 25.5 Step 0.5"
and the 0.5 can be given by a variable is all ...
Tanks you.
But here it is "Feature Requests and Wishlists" and that's what I want!
Just One for Sample : "For i.f = 2.5 to 25.5 Step 0.5"
and the 0.5 can be given by a variable is all ...
Tanks you.
Sorry for my english
! (Windows Xp, Vista and Windows 7, Windows 10)

Re: STEP Variable !
you can not increment floats!!
Example:
From 0.00 to 1.00 in 0.02 steps you need 50 steps right ?
but look this:
problem here: +0.02 not finished by 1.00 !!!
it finished at 0.99999958276749 and thats smaler then 1.0, so +1 step
Example:
From 0.00 to 1.00 in 0.02 steps you need 50 steps right ?
but look this:
Code: Select all
Count = 0
Float.f = 0.00
While Float <= 1.00
Count + 1
Float + 0.02
Debug Float
Wend
Debug "---"
Debug "steps: "+Str(Count)
Debug "---"
it finished at 0.99999958276749 and thats smaler then 1.0, so +1 step
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module