TYPEOF

Top  Previous  Next

Syntax

type = TYPEOF(variable)

Description

Returns the type of a variable.

Parameters

variable - Any defined variable.

Return value

The type of the variable.

Remarks

Generally used for the ANYTYPE subroutine parameter. Pointers will return a valid type only when used locally or specifically set with SETTYPE.

Returns one of the following constants:

@TYPECHAR

@TYPEINT

@TYPEFLOAT

@TYPEMEMORY

@TYPEFILE

@TYPEBFILE

@TYPEWORD

@TYPEDOUBLE

@TYPEUSER

@TYPEPOINTER

@TYPEINT64

@TYPEUINT64

@TYPEUINT

See Also: SETTYPE, ISREF

Example usage

SUB mysub(v as ANYTYPE)
DEF param as INT
    SELECT TYPEOF(v)
        CASE @TYPEINT
        CASE& @TYPEUINT
           IF ISREF(v) THEN param = ##<INT>v ELSE param = #<INT>v
...