[Coco] Problems with ON var GOSUB
Robert Gault
robert.gault at att.net
Thu Aug 13 17:00:19 EDT 2020
Try the following.
1) You don't need to input a string just input an integer.
2) Get rid of INPUT doit$ and just use INPUT todo .
3) Change the ON GOSUB variable so the values start at 1.
ON todo+1 GOSUB 3100,3101,3102,3103,3104
The above should get your program working.
Robert
coco at jechar.ca wrote:
>
> 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