DGL Statement Reference : VARIABLE

VARIABLE

Description
Declares variables, which are identifiers whose values can be changed in other DGL statements.
Variable values can be global when included in the initiation section, or local to a segment.
The keyword VARIABLE appears only once in the declaration section, before the data-type assignments for variables. Each data-type statement can be followed by as many identifiers of the same type as you want to define. For example:

VARIABLE STRING act_name, act_syn, act_desc;

Similarly, as many type statements as you want to define can follow the VARIABLE keyword. For example:

VARIABLE
string activity_name;
float a := 3.243;
activity act_id;

Value assignments are optional. If they are assigned, they represent the default value of the variable at the first generation of a particular document. The value can be any expression that does not contain other variables or parameters.
Variables that are declared as Statemate elements and list of items cannot be assigned initial values.
Syntax
VARIABLE
type identifier [:= value] [, identifier [:= value],...;
[type identifier [:= value],...;]
.
.
.
Parameters
 

 

Notes
The assignment of initial values is optional. An initial value is an expression that cannot contain other variables. Initial values are allowed only for integer, float, and string.
Example
VARIABLE
integer status := 0;
STATE statechart;
LIST OF STATE sub_list;
STATE sub_state, parent;
STRING name;
See Also