06-04-2020, 10:05 PM
I have recently returned to Qbasic after many years.
I never used SUBs before but I am attempting to learn and use them as I think they will make the code cleaner.
I moved some code from the main code to a SUB and it appears labels or line numbers are not allowed in a SUB?
I looked in the help and I don't see any place in the documentation that says this will not work.
Can someone explain if I need to do something different or why this would not work?
I get an error of "Label not defined" when I try to run the code.
Thank you for your help.
I never used SUBs before but I am attempting to learn and use them as I think they will make the code cleaner.
I moved some code from the main code to a SUB and it appears labels or line numbers are not allowed in a SUB?
I looked in the help and I don't see any place in the documentation that says this will not work.
Can someone explain if I need to do something different or why this would not work?
Code:
SUB init
KEY 16, CHR$(0) + CHR$(1)
ON KEY(16) GOSUB foo
KEY(16) ON
foo:
print "you did it"
END SUB
I get an error of "Label not defined" when I try to run the code.
Thank you for your help.