[futurebasic] Re: [FB] Re: FB GOTO efficiency

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Joe Lewis Wilkins <PepeToo@...>
Date: Wed, 20 Oct 1999 12:37:32 -0700
Ian Mann wrote:

> I am not sure about this but I _think_ that in the structure;
>
> select case x%
>
> case 1
> turn blue
> case 2,3
> fry an egg
> case 4
> peel a banana
> end select
>
> The  program flow jumps straight to the true case line, in other words
> only one test is made.
>
> This is much faster than tripping through a long line of ifs.

You're right Ian; EXCEPT that each of the Cases has to be evaluated until one
is located that is "true", AND there could even be more than one that is
"true" (though THEY won't be evaluated), but the "first" one in the sequence
will get all the beans; which is the reason that placing the Case Options in
order of greatest likelihood can appreciably effect the speed with which it is
RUN.

Joe Wilkins