Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / goto variable

Author
Message
Uncle Bosse
21
Years of Service
User Offline
Joined: 18th Dec 2003
Location: Sweden
Posted: 9th Feb 2004 16:41
Is there any way to use the goto command with a variable like this:

var = label1
goto var
label1:

this doesnt work for me. What am I supposed to do instead.
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 9th Feb 2004 18:35
You'd need to use an if statement:

if var$ = "label1" then goto label1
if var$ = "label2" then goto label2
etc...

There's no way to parse the contents of a variable to use in an expression like that as far as I know.

I would be unstoppable if I could just get started...

Login to post a reply

Server time is: 2025-05-22 17:37:09
Your offset time is: 2025-05-22 17:37:09