ISVARIABLE

Purpose:

Determines whether a variable or function is defined as the specified type.

Syntax:

ISVARIABLE("name", vartype)

"name"

-

A string, the variable name.

vartype

-

Optional. An integer, the type of variable:

1:

Global Variable (default)

2:

Local Variable

3:

Loaded User Function (SPL)

4:

Hot Variable

5:

Formal Variable (function argument)

6:

Window

7:

Nonlocal Variable

10:

Built-in Function

11:

Static Variable

Returns:

A 1 if the function or variable exists as specified, else returns a 0.

Example:

a = grand(100, 0.01)

b := max(a)

 

isvariable(a,1) == 1

 

isvariable(b,1) == 1

 

isvariable(b,4) == 1

 

isvariable(b,2) == 0

Example:

isvariable("fft",10) == 1

 

isvariable("myfft",10) == 0

Remarks:

Note that all hot variables are global variables.

 

The following macros are defined in system.mac:

 

isglobal(v)   isvariable(v,1)

islocal(v)    isvariable(v,2)

isspl(v)      isvariable(v,3)

ishotvar(v)   isvariable(v,4)

isformal(v)   isvariable(v,5)

isnonlocal(v) isvariable(v,7)

isbuiltin(v)  isvariable(v,10)

isstatic(v)   isvariable(v,11)

 

ISVARIABLE and ARGC are useful in detecting optional arguments to an SPL function.

 

ISVARIABLE can be abbreviated ISVAR.

See Also:

ARGCOUNT

ISMACRO

VALUETYPE