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.

Newcomers DBPro Corner / Gosub Labels

Author
Message
Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 13th Oct 2005 10:46
Is there a correct way to create a gosub label using two connected strings? In DB Classic 1.13, the example below gives a 'label name is not valid' error. R$="R" : str$(RO)=RO : 'The idea being that the label the gosub would look for would be - R1,R2, etc. depending on value of RO. I.E. - gosub R$+str$(RO). Or am I SOL on this idea?
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 13th Oct 2005 15:29
Just use an if/then statement.



I R tEh Antid0te! ROOOAAAR!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 13th Oct 2005 16:03
im pretty sure you cant generate labels via code. they are predefined in your code and called via gosub xxx like a keyword. they cant be the result of some string concatenation from executable code.

Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 13th Oct 2005 21:51
Quote: "
Just use an if/then statement.
"

Yes, but I have a list of 19 gosubs.

Quote: "
im pretty sure you cant generate labels via code.
"

Thank you. I didn't want to waste any more time trying to get this to work.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 13th Oct 2005 22:23 Edited at: 13th Oct 2005 22:23
When you want to pick multiple results from a variable without if/thens use select/case.

Hope this helps:

Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 13th Oct 2005 22:29
That works as well. Yours and mine Grog Grueslayer are essentially the same thing.

I R tEh Antid0te! ROOOAAAR!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Oct 2005 10:38
Quote: "That works as well. Yours and mine Grog Grueslayer are essentially the same thing."


True but I was thinking along the lines of getting rid of the all the gosubs and copy the code into each case statement. Of course he could do that with if/thens too.

Login to post a reply

Server time is: 2024-11-27 16:44:08
Your offset time is: 2024-11-27 16:44:08