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 Discussion / DB scope rules

Author
Message
EddieRay
22
Years of Service
User Offline
Joined: 28th Feb 2003
Location: USA
Posted: 6th Mar 2003 18:22
From what I've seen in the posts lately, it would appear that arrays are global and can be accessed inside of functions... is this correct?

Are variables outside of functions accessible in functions?

I saw a post about using #include to load functions - do the functions loaded this way work just like they where inlined at the point of the #include statement (i.e., do they had the same access to arrays and or variables?).

TYPEs: can I pass a "type" variable to a function and access its members inside the function normally?

Thanks,

Ed
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Mar 2003 19:11
In answer to your questions:

Yes - arrays are global
No - variables outside functions are not accessible inside functions
Yes - functions are inlined at the point of #include
??? - There are no types in DB. In DBPro, the answer to this one is no but we're hoping.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Mar 2003 03:25
DBC has types with psuedo array compilation using dark edit.

variables in DBP can be globalised but not in DBC

u can duplicate variable names to hand them over from functions but it gets pretty messy in this regard.

Login to post a reply

Server time is: 2025-08-08 20:40:17
Your offset time is: 2025-08-08 20:40:17