First post - first program - I want to initialize some variables before the mainloop executes and have subroutines below the mainloop controlled by gosubs within the mainloop. The problem I've been seeing is the gosubs seems to execute without being called, for example a initialize the variables sub routine, like the program kept going instead of returning to the top of the mainloop. Do I need an "end" after goto mainloop?
for example
gosub init:
MAINLOOP:
if x = 2 then
gosub dothis
endif
goto mainloop
dothis:
program
return
init:
x = 1
return
I've seen the dothis sub routine get executed without gosub being executed...like the program just keeps going past the goto mainloop command - (crude example of my real program)
I'm wondering if I'm missing a golden rule of keeping my program flow within the mainloop.
Bookmarks