Code: Select all
For a.f = 0 To 40 Step .5
PrintN(StrF(a))
Next
Russell
Code: Select all
For a.f = 0 To 40 Step .5
PrintN(StrF(a))
Next
Code: Select all
Macro FFor(var, ffrom, fto, fstep = 1.0)
var = ffrom - fstep
While var <= fto - fstep
var + fstep
EndMacro
x.f = 7.0
FFor(x, 11.5, 13.0, 0.5)
Debug x
Wend
I would elevate this to "necessity" from "nicety".Amiga5k wrote:Trying out PB4b1 and I'm surprised to see that I still can't do this:Yes, there are other ways to do the above, but it would be nice if For Next supported all "core" number types.Code: Select all
For a.f = 0 To 40 Step .5 PrintN(StrF(a)) Next
Russell
Code: Select all
n.f = 0
while n.f < 100
...
n.f = n.f+1.7
wend
As do C, Perl, and a bunch of languages I never program in. People coming to PB from other languages or dialects of BASIC may see this as a shortcoming and that could hinder the advancement of PB. As for 3.00000000000000002 being > 3, I say leave that to the programmer to deal with, not the language developer.personally, i think coding for / next loops with anything but ints is wrong
...Except that every other BASIC dialect currently available has supported floats in For/Next loops for a long time now.
Each basic do things different.blueznl wrote:walker, you're right, but in floats is 2.8 + 0.2 not the same as 3.0 as in float 2.8 might be 2.80000000000000001 and 0.2 might be actually 0.20000000000000001 so the total might be 3.00000000000000002 and that's more than 3...
that's why i never use for next for floats
Why is that? Especially when using Longs in For..Next rather then Int, results in faster code.blueznl wrote:personally, i think coding for / next loops with anything but ints is wrong, i'd always suggest to use
but i agree, it's a matter of taste...Code: Select all
n.f = 0 while n.f < 100 ... n.f = n.f+1.7 wend