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 / code question

Author
Message
CasinoDuck
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location:
Posted: 29th Dec 2002 05:08
any one know why this wouldn't work?

for y = 1 to 4
if racerp(1)=y then gosub racerstat(y)
next y

exe builder crashes when it see's racerstat(y)
know of a better way to get the same result?
CasinoDuck
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location:
Posted: 29th Dec 2002 06:03
racerstat:
for y = 1 to 4
if racerp(1)=y then gosub racerstat(y)
next y

racerstat1:
print " it worked1"
wait key

racerstat2:
print " it worked2"
wait key

racerstat3:
print " it worked3"
wait key

racerstat4:
print " it worked4"
wait key

bit more discription of what i'm trying

CasinoDuck
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location:
Posted: 29th Dec 2002 06:20
do you think DB is thinking i'm trying to gosub an array?

Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 29th Dec 2002 06:28
Actualy more like your example is trying to gosub to a value in the array, which is impossible.

If I understand you correctly, you would like something like:

On <value> Gosub <label 1>,<label 2>,...,...

Which is common in most BASIC languages, alas, DB can't do this.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
CasinoDuck
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location:
Posted: 29th Dec 2002 06:29
oh sigh........

CasinoDuck
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location:
Posted: 29th Dec 2002 06:34
Know of a good work around?

Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 29th Dec 2002 06:52
I have no idea if this is anything like what you need.



Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
CasinoDuck
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location:
Posted: 29th Dec 2002 06:58
hmmm man.. that looks sweet.... i'm putting that in now... thx...

CasinoDuck
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location:
Posted: 29th Dec 2002 07:05
TYVM for this work around.... saved alot me of "IF"'s ;o)

Login to post a reply

Server time is: 2024-11-23 19:35:13
Your offset time is: 2024-11-23 19:35:13