Variables
All types can be assigned to named variables. Named variable identifiers are 1 to 63 characters long, start with and further consist of the characters up to a maximum of 63 characters. Named variables are not case sensitive.
Variables have one of the following scopes:
- LOCAL: Visible only within the routine which declared it. Value is lost upon exit of the routine.
- STATIC: Visible only within the routine which declared it. Value is preserved for subsequent invocations of the routine. If a STATIC variable is declared before any Procedure/Function/Method is defined, it has a MODULE scope, and is visible within any routine defined within that same source file, it will maintain its life for the duration of the application lifetime.
- GLOBAL Visible within any routine defined in the same source module where the GLOBAL variable is declared, as well as any routine of any other source module, which explicitly declares it, by means of the GLOBAL EXTERNAL declaration. Both GLOBAL and GLOBAL EXTERNAL declarations must be declared before any Procedure/Function/Method is defined.
- PRIVATE: Visible within the routine which declared it, and all routines called by that routine.
- PUBLIC: Visible by all routines in the same application.
LOCAL, STATIC, and GLOBAL are resolved at compile time, and thus are much faster than PRIVATE and PUBLIC variables which are dynamic entities accessed by means of a runtime Symbol table. For this same reason, LOCAL, STATIC and GLOBAL variables are not exposed to the Macro compiler, and any macro code which attempts to reference them will generate a runtime error.
Due to the dynamic nature of PRIVATE and PUBLIC variables, they can be created and destroyed at runtime, can be accessed and modified by means of runtime macros, and can be accessed and modified by Codeblocks created on the fly.
Read more about this topic: XHarbour
Famous quotes containing the word variables:
“Science is feasible when the variables are few and can be enumerated; when their combinations are distinct and clear. We are tending toward the condition of science and aspiring to do it. The artist works out his own formulas; the interest of science lies in the art of making science.”
—Paul Valéry (18711945)
“The variables are surprisingly few.... One can whip or be whipped; one can eat excrement or quaff urine; mouth and private part can be meet in this or that commerce. After which there is the gray of morning and the sour knowledge that things have remained fairly generally the same since man first met goat and woman.”
—George Steiner (b. 1929)
“The variables of quantification, something, nothing, everything, range over our whole ontology, whatever it may be; and we are convicted of a particular ontological presupposition if, and only if, the alleged presuppositum has to be reckoned among the entities over which our variables range in order to render one of our affirmations true.”
—Willard Van Orman Quine (b. 1908)