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 Professional Discussion / Functions and Local variables?

Author
Message
TerraX
21
Years of Service
User Offline
Joined: 28th Sep 2002
Location: United Kingdom
Posted: 30th Sep 2002 17:17
Hiya, is it possible to declare a variable inside a function, which only the function can access, but also does not lose it's value once the function has been executed?

Cheerz
ADVERTISMENT!
www.DavesProgramming.com
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 30th Sep 2002 20:10
Afraid not. The only way to do it would be to store the variable value somewhere else (array, type, memblock, data, etc).

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 30th Sep 2002 20:28
variables like :
_value=2
are automatically local variables

variables like :
_value(2)=5
are automatically global variables
TerraX
21
Years of Service
User Offline
Joined: 28th Sep 2002
Location: United Kingdom
Posted: 30th Sep 2002 21:08
Oh well, no major loss.
Only got DBP this morning, so expect more questions
ThanX.

ADVERTISMENT!
www.DavesProgramming.com

Login to post a reply

Server time is: 2024-05-07 02:34:21
Your offset time is: 2024-05-07 02:34:21