Amiga.org
Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: blakespot on October 11, 2013, 10:13:16 PM
-
I've got a question for anyone that ever played around with AmigaBASIC. (Not ABasiC, but AmigaBASIC that came after.)
I have a program that is doing some GOSUBs to a subroutine. Inside that subroutine, I need to do a GOTO to a sub-section of the subroutine code, depending on a variable state. How is this done, with labels?
I try:
MySubroutine:
x=0:y=0
read x,y....blabla
...
...
...
...
if x > whatever then goto (that read line above)
RETURN
Whenever I change that read line to...
ReadLine: read x,y .....blablabla
and then...
...goto ReadLine
I get undefined routine error. Not wanting to use line numbers for this - AmigaBASIC wasn't setup for that, really.
Basically, how does on goto inside a subroutine, is the question?
Thanks!
bp
-
I have no experience with AmigaBASIC but you should use while statement instead.
-
Do the goto on the next line:
IF x >
THEN GOTO subroutine
END IF
-
>Whenever I change that read line to...
>ReadLine: read x,y .....blablabla
IIRC labels need to be on their own separate line.
-
Do the goto on the next line:
IF x >
THEN GOTO subroutine
END IF
Learn to do it right, and use while instead of goto :p