Scope of Global Variables

Navigation:  Macros > Macro Language > Variables > Global Variables >

Scope of Global Variables

Previous pageReturn to chapter overviewNext page

Global Variables are specific to each macro index and to each DiaryGridLine.


This means that there will be no interference between the Global Variables of the same macro which is used in 2 DiaryGridLines, in the same Script. For example suppose you had a macro using ng1 to count the number of pages, being used both in a 5 pages and in another 12 page DiaryGridLine, of the same Script. At the end of the Script generation there would be 2 separate instances of ng1, one with value 5 and the other with value 12.


Similarly, within the same DiaryGridLine, if the same macro is used for 2 different macro indices (for example [1*1xxx] and [1*2xxx]), the value of ng1 stored for the token [1*1xxx] will be totally independent of the value of ng1 stored for the token [1*2xxx].


You can, however, share global variables between different macro tokens of the same DiaryGridLine, as long as they share the same macro index. We will see an example below.

Topic 134800 updated on 17-Mar-2001.
Topic URL: