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 / functions and arrays

Author
Message
totalnewb
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location: United Kingdom
Posted: 4th Jan 2004 17:20
im reading through the manual but i cant figure out wat "FUNCTIONS AND ARRAYS ARE"
totalnewb


This is my area...

Leave it...
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Jan 2004 18:28 Edited at: 4th Jan 2004 18:38
Arrays from the dbpro help
help > principles > data types and variables



fumctions from the dbpro help

help > principles > functions



One thing the help doesn't mention about functions is variable scope. I can't say this is how it is in dbc but it in dbpro.
Arrays are global
normal variables can be made global with the global command;
global a#
global a as float
global variables can be read and written to within all code.

normal variables declaired out of funtions can not be set or read from within a funtion so if you want to have access to a variables data you need to pass it to the function or make it global or store in in an array.

I think variables declaired in functions are local by default. You can also use the local keyword;
local a#
local a as float
Local variables can be read/writen to only by their parent function. You can give variables outside of the function the same name and they are seperate from each other. Local variables do not keep their value between function calls.
I think that is correct, I am sure someone will correct me if anything is wrong

dbpro : 2ghz p4m : 512mb : geforce 4 4200 go
totalnewb
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location: United Kingdom
Posted: 4th Jan 2004 18:44
thanks for that. you know more thaan me

This is my area...

Leave it...

Login to post a reply

Server time is: 2024-11-25 23:20:34
Your offset time is: 2024-11-25 23:20:34