nxtbasic : this loop runs automatically

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

nxtbasic : this loop runs automatically

Post by funkheld »

hello, good day.
why does the loop automatically with gosub and sub ?

thanks.
greetings

--------------------------------------
SCREEN 128

StartEdit:
Loop:
Key$=GET
if Key$="D" then g = 129 : test()
Goto loop
end

sub test()
print "HALLO"
end sub
---------------------------------------


--------------------------------------
SCREEN 128

StartEdit:
Loop:
Key$=GET
if Key$="D" then g = 129 : gosub test
Goto loop
end

test:
print "HALLO"
return
---------------------------------------


it is ok without g = 129
--------------------------------------
SCREEN 128

StartEdit:
Loop:
Key$=GET
if Key$="D" then gosub test
Goto loop
end

test:
print "HALLO"
return
--------------------------------------
Attachments
Bild1.jpg
Bild1.jpg (10.57 KiB) Viewed 925 times
nofehler.jpg
nofehler.jpg (5.84 KiB) Viewed 925 times
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtbasic : this loop runs automatically

Post by unartic »

It's a bug :-) It will be fixed with the next version of nxtBasic.

To workarround the bug, you can avoid putting commands on the same line as the IF-statement. So This will work:

Code: Select all

SCREEN 128

StartEdit:
Loop:
Key$=GET
if Key$="D" then 
    g = 129 : gosub test
end if
Goto loop
end

test:
print "HALLO"
return
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtbasic : this loop runs automatically

Post by funkheld »

hello, thanks for the help.

can you please remove this in screen 128 as well?

greetings
Attachments
fehler11.jpg
fehler11.jpg (6.09 KiB) Viewed 879 times
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtbasic : this loop runs automatically

Post by unartic »

It's only visible when the bitmap layer is visible (screen 128). So yes, it will be gone soon :-)
Post Reply