[Coco] Basic09 question

Bob Devries devries.bob at gmail.com
Thu Mar 27 22:06:12 EDT 2008


George,
were you thinking of the ON GOSUB command?
You can use that provided your choices are (a) numeric, and (b) sequential 
numbers.

INPUT "Choice:", answer
ON answer GOSUB 10, 20, 30

You can use ON GOTO also.

If your variable is not numeric, you can convert it using the SUBSTR 
command.

Page 11-100 of the BASIC09 manual for ON/GOSUB, and 11-164 for SUBSTR


--
Regards, Bob Devries, Dalby, Queensland, Australia

Isaiah 50:4 The sovereign Lord has given me
the capacity to be his spokesman,
so that I know how to help the weary.

website: http://www.home.gil.com.au/~bdevasl
my blog: http://bdevries.invigorated.org/

----- Original Message ----- 
From: "George Ramsower" <georgeramsower at gmail.com>
To: <coco at lists5.maltedmedia.com>
Sent: Friday, March 28, 2008 12:52 PM
Subject: [Coco] Basic09 question


>I seem to remember(in my old memories) there was a way to use IF/THEN in a 
>way that would:
>
> use GOSUB, line1,line2,line3.. etc. when comparing an input from the user.
> For example:
>
> input"Choices", answer
> if answer = "whatever1" then gosub 1 \endif
> if answer = "whatever2" then gosub 2 \endif
>
> This is clunky.
>
> The thing that is in my head is that there was a way to make it do it all 
> in one small segment instead of a whole buch of IF/THEN tests.
>
>
> Does this make sense?
>
>
> Thanks,
>
> George
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco 




More information about the Coco mailing list