Global_Variable command

See Also: Global Variables, DataFlex built-in Global Variables

Purpose

Use the Global_Variable command to ensure a variable declaration is unambiguously defined as being global when so intended.

Syntax

For strings

Global_Variable {data-type} {variable-name} [{maximum-length}]

For all other data types

Global_Variable {data-type} {variable-name}

 

where

What It Does

Variables declared outside procedures and functions are implicitly global, but using the global_variable command reduces ambiguity and declares the intent for a variable to be global; it reduces any chance of code misinterpretation.

You can also use the global_variable command to declare global variables inside functions and procedures, but this technique is strongly discouraged, as it creates code that is difficult to follow.

Example

global_variable String gsCompanyName

This example defines a global String variable named gsCompanyName (with an implied maximum length of 80 characters).