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 / passing values

Author
Message
C++ Boy
21
Years of Service
User Offline
Joined: 4th Jan 2003
Location: United States
Posted: 4th Jan 2003 21:20
i know how values can be passed into functions, like



but how do you pull the values out of the function like in c++? or is that even possible? how can the two new values be updated in the rest of the program?
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 4th Jan 2003 21:31
how about :



which, in this case, will return 20.

ENDFUNCTION can only return 1 value, and no type's...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
C++ Boy
21
Years of Service
User Offline
Joined: 4th Jan 2003
Location: United States
Posted: 4th Jan 2003 21:41
oh. thanks. so the only way to get more than one value is by using a gosub instead of a function?

Rincewind
21
Years of Service
User Offline
Joined: 4th Jan 2003
Location:
Posted: 5th Jan 2003 01:23
No. You can use global variables.

The only way to have global variables in DB are arrays(as far as i know... i haven't used DB for over 6 months).

For example you can use an array with only one index (ex dim health(0))in oreder to have single global variables.

jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 5th Jan 2003 02:02
With DB Pro i've you can do

GLOBAL MyVar AS INTEGER

or

GLOBAL MyVar$ AS STRING

Or Even

GLOBAL MyVar AS MyCustomType

And it can be used inside functions. This revelation (Which I found through this forum) saved me a lot go gosubs )

Jas

Login to post a reply

Server time is: 2024-04-13 17:08:10
Your offset time is: 2024-04-13 17:08:10