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.

Author
Message
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 3rd Nov 2003 18:14
Lets say i want to have a variable called t in a function. When i call the function t will be incremented. When i exit the function t should not have the value it had in the function and actually unless i say otherwise, t should still be 0 outside of the function. When i return to the function value of t should still be whatever i left it as when i last left the function in otherwords if i called the function and i increased t from 0 to 1, it should still be 1 when i return.
For some reason its not... I thought this was the idea of functions. I didn't think that when i went back to the function it would be reset back to 0. and yet it is. I dont want to declare a global variable because i dont want T in my funtion to interfear with t in the rest of the program. i want them to be 2 separate variables that i can leave and come back to and they will be as i left them.

The following threads and their accompanying sound tracks are protected by copyright and any broadcast public diffusion, copying and edditing are etc... etc.. you may not complain about my Typo's
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 3rd Nov 2003 18:29
While DB supported STATIC variables within functions, DBPRO doesn't. In order to simulate a Static variable, you'd need to make it global for the variable to persist between calls. So until Dbpro gets a STATIC variable command, you'll have to store your counters somewhere..

Kevin Picone
Play Basic - Visible Worlds - Kyruss II
[url]www.underwaredesign.com[/url]
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 5th Nov 2003 00:22
baga

The following threads and their accompanying sound tracks are protected by copyright and any broadcast public diffusion, copying and edditing are etc... etc.. you may not complain about my Typo's

Login to post a reply

Server time is: 2026-07-26 16:04:07
Your offset time is: 2026-07-26 16:04:07