DADiSP Worksheet Functions > Function Categories > Variables > VALUETYPE

 

VALUETYPE

Purpose:

Returns the type of data stored in the specified variable.

Syntax:

VALUETYPE(var, vartype)

var

-

Variable or variable name.

vartype

-

Optional. An integer, the type of variable:

1:

Global Variable (default)

2:

Local Variable

3:

User Function (SPL)

4:

Hot Variable

5:

Formal Variable (function argument)

Returns:

An integer representing the type of the variable's data. The return integer can be one of the following:

-11:

Unspecified

1:

Integer

2:

Real

3:

Complex

4:

String

5:

Series

6:

Window

10:

Function

104:

Pointer

105:

Object Handle

120:

Window Reference

Example:

a = 10; b = 20.0; c = integ(w1)

 

valuetype(a) returns 1

 

valuetype(b) returns 2

 

valuetype(c) returns 5

Example:

The file SERIES.H includes a number of useful macros to simplify SPL functions. For example, the IS_UNSPECIFIED macro can be used to determine if an argument to a function is not specified.

 

#include <series.h>
 
sqr(x)
{
    if (IS_UNSPECIFIED(x))
    {
        x = 10;
    }
 
    return(x * x);
}

 

Argument x is default to 10 if not specified.

See Also:

ARGCOUNT

ARGTYPE

ISARRAY

ISCOMPLEX

ISFUNC

ISMACRO

ISNUMERIC

ISREAL

ISSCALAR

ISSTRING

ISVARIABLE

ISWINDOW