Page 1 of 1

nxtbasic : this loop runs automatically

Posted: Mon Jul 29, 2024 7:55 am
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
--------------------------------------

Re: nxtbasic : this loop runs automatically

Posted: Mon Jul 29, 2024 11:30 am
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

Re: nxtbasic : this loop runs automatically

Posted: Mon Jul 29, 2024 1:33 pm
by funkheld
hello, thanks for the help.

can you please remove this in screen 128 as well?

greetings

Re: nxtbasic : this loop runs automatically

Posted: Mon Jul 29, 2024 1:36 pm
by unartic
It's only visible when the bitmap layer is visible (screen 128). So yes, it will be gone soon :-)