how to design a website for free

TYPE CHECKING FUNCTIONS

SYNTAX

FUNCTION ISBOOLEAN (X AS VARIANT) AS BOOLEAN

FUNCTION ISBYTE (X AS VARIANT) AS BOOLEAN

FUNCTION ISCOMPLEX (X AS VARIANT) AS BOOLEAN

FUNCTION ISDOUBLE (X AS VARIANT) AS BOOLEAN

FUNCTION ISFLOAT (X AS VARIANT) AS BOOLEAN

FUNCTION ISINTEGER (X AS VARIANT) AS BOOLEAN

FUNCTION ISLONG (X AS VARIANT) AS BOOLEAN

FUNCTION ISSHORT (X AS VARIANT) AS BOOLEAN

FUNCTION ISSTRING (X AS VARIANT) AS BOOLEAN

FUNCTION ISUNKNOWN (X AS VARIANT) AS BOOLEAN

DESCRIPTION

These functions are usually used with a VARIANT argument. Whilst they will work with any data type their use is redundant since you would already know the argument type..

Examples


SUB MAIN

    DIM X AS VARIANT

    X = VARIANT(25.5)

    IF (ISBOOLEAN(X)) THEN

        PRINT "X IS A BOOLEAN"

    ELSEIF (ISBYTE(X)) THEN

        PRINT "X IS A BYTE"

    ELSEIF (ISSHORT(X)) THEN

        PRINT "X IS A SHORT"

    ELSEIF (ISINTEGER(X)) THEN

        PRINT "X IS A INTEGER"

    ELSEIF (ISLONG(X)) THEN

        PRINT "X IS A LONG"

    ELSEIF (ISFLOAT(X)) THEN

        PRINT "X IS A FLOAT"

    ELSEIF (ISDOUBLE(X)) THEN

        PRINT "X IS A DOUBLE"

    ELSEIF (ISCOMPLEX(X)) THEN

        PRINT "X IS A COMPLEX"

    ELSEIF (ISSTRING(X)) THEN

        PRINT "X IS A STRING"

    ELSEIF (ISUNKNOWN(X)) THEN

        PRINT "X IS A UNKNOWN"

    ELSE

        PRINT "X IS INVALID"

    END IF 

END SUB