DADiSP Worksheet Functions > Function Categories > Variables > DEFVAR

 

DEFVAR

Purpose:

Sets the value of a global variable if the variable is undefined.

Syntax:

DEFVAR("name", value)

"name"

-

A string. The name of the global variable.

value

-

A string, scalar, series or table, the value to assign if the variable is undefined.

Returns:

Nothing. Defines and sets the variable if it is undefined.

Example:

defvar("myvar", 10)

 

If myvar is undefined, myvar is set to 10.0

Remarks:

DEFVAR is used by several panels and SPL routines to create variables that behave similar to C/C++ static variables.

See Also:

SETVARIABLE