When a program is compiled, a GOSUB statement needs to know the specific 
line number to jump to.  In your example, the compiler has no idea what 
the value of SUBNAME is, so it cannot determine the line number.  The 
reason for this, I think, is to maximize the execution speed.  The program 
jumps to a specific line (very fast), as opposed to having the program 
search for the line number and then jump.

On the plus side, you can do what you are looking for with a CASE 
statement or ON GOSUB, both of which are probably mentioned in those 
unread emails that I see in my Inbox.

[EMAIL PROTECTED] wrote on 02/08/2006 02:03:39 PM:

> I would like to pass a variable (let's call it "SUBNAME") to a 
subroutine,
> and this variable would contain the name of an existing label which I 
will
> call "TEST".
> 
> The subroutine can then do GOSUB TEST, but GOSUB SUBNAME will not 
compile.
> 
> Aside from CALL @VARIABLENAME, is there any way to branch indirectly in
> universe? This would be really useful for me.
> 
> Barry Brevik
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to