[futurebasic] Re: [FB] Computed GOTO or GOSUB?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2003 : Group Archive : Group : All Groups

From: Peter Bancroft <peter@...>
Date: Sun, 6 Apr 2003 03:22:53 +1000
Maybe use CASE.

Evaluate n then:

SELECT n
     CASE 1  : Fn NumberOne
     CASE 2  : Fn NumberTwo
     CASE n>2    : Fn NumberIsGreaterThanTwo
     CASE etc ...
END SELECT

Case is very fast.

Something here rings a bell about VARPTR, but my manuals are packed in a
box at the moment 8(

Peter


>Hello all,
>    I frequently want to set up a situation in which a series of numbers
>or characters are efficiently used to call each a uniquely defined FN
>elsewhere.  Think of a series of characters or numbers representing a
>sequence of steps in a process (like genes on a chromosome) that could
>be read (translated) sequentially by executing the FN indicated by each
>individual number or character.  This could have been done in Applesoft
>(if memory serves) with a "computed GOTO":  as in GOTO <expr> or GOSUB
><expr>, but I seem not to be allowed to do this by the FB^3 compiler
>(r7).  I am required to have an immediate "..." or a line number.  My
>question is: do we have an efficient way of working around this
>apparent limitation in FB^3?  How can I efficiently code something like:
>DIM as integer n
>DIM Aray(255) AS UNSIGNED BYTE
>For n=0 to 255
>GOSUB Aray(n)
>next n ?
>Many thanks in advance for trying to think me out of this bind...
>Hayden
>
>
>--
>To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>