[Coco] Problems with ON var GOSUB

coco at jechar.ca coco at jechar.ca
Thu Aug 13 14:14:57 EDT 2020


The first SHELL "list /dd/SH/osd" displays the contents
of the file  /dd/SH/osd as expected but the ON var GOSUB
does not work. Am I missing something or do I need to rewrite
the code using ON var GOTO and replace the returns with
GOTO 3000s

PROCEDURE testit

DIM line$,c$,go$,doit$:STRING
DIM tc,cv,custom,todo:INTEGER
DIM fp:BYTE

SHELL "list /dd/SH/osd"

    LOOP
       PRINT "+---------------------------+"
       PRINT "| 0. Exit                   |"
       PRINT "| 1. List File              |"
       PRINT "| 2. Edit File              |"
       PRINT "| 3. Run  File and Exit     |"
       PRINT "| 4. Delete File and Exit.  |"
       PRINT "+---------------------------+"
       INPUT doit$
       todo=VAL(doit$)
       ON todo GOSUB 3100,3101,3102,3103,3104
3000 (* Do not actually have this line. *)
    ENDLOOP
END
3100 (* Exit *)
END
RETURN
3101
PRINT "listing of /dd/SH/osd"
SHELL "list /dd/SH/osd"
RETURN
3102
PRINT "Entering Editor"
PRINT "Use ^K to delete any lines"
PRINT "    ^S to save your changes"
PRINT "[BREAK]to exit"
PRINT
INPUT "PRESS [ENTER] to Start ";go$
SHELL "minted /dd/SH/osd"
RETURN
3103
SHELL "/dd/SH/osd"
END
RETURN
3104
SHELL "del /dd/SH/osd"
END
RETURN
END


More information about the Coco mailing list