REBOL Document

Type? - Function Summary


Summary:

Returns a value's datatype.

Usage:

type? value

Arguments:

value - The value argument. (must be: any-type)

Refinements:

/word - Returns the datatype as a word.

Description:

To check for a single datatype, use its datatype test function (e.g. string?, time?) The /WORD refinement returns the type as a word so you can use if for FIND, SELECT, SWITCH, and other functions.


    print type? 10
    integer


    print type? :type?
    native


    value: 10:30
    print switch type?/word value [
        integer! [value + 10]
        decimal! [to-integer value]
        time! [value/hour]
        date! [first value/time]
    ]
    10

Related:

block? - Returns TRUE for block values.
date? - Returns TRUE for date values.
decimal? - Returns TRUE for decimal values.
email? - Returns TRUE for email values.
file? - Returns TRUE for file values.
function? - Returns TRUE for function values.
integer? - Returns TRUE for integer values.
issue? - Returns TRUE for issue values.
logic? - Returns TRUE for logic values.
make - Constructs and returns a new value.
money? - Returns TRUE for money values.
native? - Returns TRUE for native values.
none? - Returns TRUE for none values.
object? - Returns TRUE for object values.
paren? - Returns TRUE for paren values.
path? - Returns TRUE for path values.
port? - Returns TRUE for port values.
string? - Returns TRUE for string values.
time? - Returns TRUE for time values.
tuple? - Returns TRUE for tuple values.
url? - Returns TRUE for url values.
word? - Returns TRUE for word values.


<Back | Index | Next>

Copyright 2004 REBOL Technologies