REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: type?

type?  value  /word

Returns a value's datatype.

Arguments:

value [any-type!]

Refinements:

/word - Returns the datatype as a word

See also:

make   none?   logic?   integer?   decimal?   money?   tuple?   time?   date?   string?   email?   file?   url?   issue?   word?   block?   paren?   path?   native?   function?   object?   port?  

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


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin