|
Post by rosy on Sept 26, 2021 12:12:31 GMT -6
After all, we discussed this all the time ... For a = 1 then 0 should not be done.
|
|
|
Post by n00b on Sept 26, 2021 12:22:14 GMT -6
I just tried this out and it is working the way its supposed to.
for a = 1 to 0 print a next
This will print 1. The first iteration in a for loop will always happen because it will always be in the expected range.
|
|
|
Post by rosy on Sept 26, 2021 13:16:05 GMT -6
For STEP 1 it doesn't make sense. In any Basic I use, this is not done. Even on the ZX81 ... There is no 1 to 0 range.
|
|
|
Post by aurel on Sept 26, 2021 14:33:30 GMT -6
in oxygen basic for n = 1 to 0 step -0.1 and work of course
|
|
|
Post by rosy on Sept 26, 2021 15:19:22 GMT -6
Try Noob example...
|
|
|
Post by aurel on Sept 27, 2021 0:06:03 GMT -6
oh shi*t ..compile but nothing ..without error also with step -0.3 result is always 1 and stuck in infinite loop what a crapp
|
|
|
Post by rosy on Sept 27, 2021 2:30:09 GMT -6
If it does nothing, then it's okay. If it hangs, it's a mistake.
|
|
|
Post by n00b on Sept 27, 2021 8:48:58 GMT -6
I personally think the way it works now makes more sense but it does seem every other BASIC does check if it is a valid loop before executing. I will see if I can get this change into the next release.
|
|
|
Post by rosy on Sept 27, 2021 9:28:47 GMT -6
I don't know what the point of this is. I have a problem with that in the next game. I have to add additional conditions. ? No sense...
|
|
|
Post by aurel on Sept 28, 2021 2:48:03 GMT -6
dont use for loop if you really dont need it use while / wend
n=1 while n > 0 ... ... ... n = n - 0.1 wend
|
|
|
Post by rosy on Sept 28, 2021 3:31:36 GMT -6
Well, I can use a different programming language at all ...
|
|
|
Post by aurel on Sept 28, 2021 5:51:05 GMT -6
yes ..everybody can... but rosy...you not explain why you exactly need for loop? why cannot be while/wend ?
|
|
|
Post by aurel on Sept 28, 2021 6:14:17 GMT -6
I just made quick test with while loop in RC basic and looks to me that work well and on same way as i have in my micro(A) xmax = 640 ymax = 480 title$ = "Test while" WindowOpen(1,title$,100,100,xmax,ymax,0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0) ClearCanvas sw = xmax sh = ymax pi = 3.14 y=10 x=40 p$ = " " arial = 1: loadFont(1, "assets2/arial.ttf", 14) Font(arial) setColor(rgb(140, 180, 200)) '====================================================================== n = 1 while n > 0 y = y + 20 p$ = str(n) DrawText(p$, x, y)
n = n - 0.1 wend
update()
'press space to exit! while waitkey() <> 32 wend
|
|
|
Post by rosy on Sept 28, 2021 6:17:01 GMT -6
Functions are supposed to work as expected, not combinations ...
|
|
|
Post by aurel on Sept 28, 2021 6:29:16 GMT -6
here is a same program in micro(A)..(well i dont have for/loop yet ) 'test_while from 1 to 0... var x,y,st,n wcolor 255,250,205 : fcolor 0,0,0 x = 50 y = 10 st = 0.1 n = 1 '------------------------- while n > 0 y = y + 20 print x, y ,n
n = n - st swap wend
|
|