and it was mandatory for me that it still looked Basic-like.
This is what I came up with quickly. Seems to work okay,
but I may have missed something. Use at your own risk!

It uses two macros to do the magic. The macro "Forr" sets
up the loop, and takes 4 parameters: variable name, start,
finish, and step. If start>finish then the loop counts up, but
if start<finish then the loop counts down (like "Step -1").
The step parameter can be a variable, or float, or BOTH!

The second macro, "Nextt()", just finishes the loop. Enjoy!
Code: Select all
; For/Next with floats and/or variable for Step.
; By PB -- Do whatever the heck you want with it.
; Yes, I know other float values affect precision!
Macro Forr(var,start,finish,inc)
CompilerIf start<finish
var=start-inc : While var<finish : var+inc
CompilerElse
var=start+inc : While var>finish : var-inc
CompilerEndIf
EndMacro
Macro Nextt()
Wend
EndMacro
stp.f=0.5 ; Float *and* variable for Step!
Forr(a.f,1,5,stp) ; For a = 1 To 5 Step 0.5
Debug a ; 1.0, 1.5, 2.0, 2.5, 3.0, [...]
Nextt()
Forr(a.f,4.5,1,0.5) ; For a = 4.5 To 1 Step -0.5
Debug a ; 4.5, 4.0, 3.5, 3.0, 2.5, [...]
Nextt()