Page 1 of 1
Project Files & Variables
Posted: 05 July 2011, 17:51 PM
by everest
Hey Don,
I've noticed that global variables from one file to the next don't seem to carry over in a project. Is that an inherent limitation or am I just missing something (as usual!)?
-Jeff
Re: Project Files & Variables
Posted: 05 July 2011, 18:45 PM
by dkinzer
everest wrote:I've noticed that global variables from one file to the next don't seem to carry over in a project.
They do if you define them in a particular way. A variable defined at the module level (outside of any procedure) can be truly global (i.e. visible to other modules) or it may be private to the module (i.e. only visible to procedures in that module). If you define a variable at the module level using the
Dim keyword it is private to the module. If you want it to be visible to procedures in other modules, you must define it using
Public instead of
Dim.
The distinctions between Public, Private and Dim are explained in the ZBasic Language Reference Manual in the section entitled
Defining Variables.
Posted: 05 July 2011, 20:25 PM
by everest
Ah ha! I figured it was something I was missing. Naturally related to a "Dim" statement. . .somewhat insulting really. . . .
-Jeff