REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 18-Apr-2009 Edit History  

REBOL 3 Concepts: Expressions: Values

Pending Revision

This document was written for R2 and has yet to be revised for R3.

REBOL provides a built-in set of values that can be expressed and exchanged between all systems. Values are the primary elements for composing all REBOL expressions.


Direct and Indirect Values

Values can be directly or indirectly expressed.

A directly expressed value is known as it is lexically, or literally, written. For instance, the number 10 or the time 10:30 are directly expressed values.

An indirectly expressed value is unknown until it is evaluated. The values none!, true, and false all require words to represent them. These values are indirectly expressed because they must be evaluated for their values to be known. This is also true of other values, such as lists, hashes, functions, objects.

Datatypes of Values

Every REBOL value is of a particular datatype. The datatype of a value defines:

  1. The range of possible values for the datatype. For example, the logic datatype can only be true or false.
  2. The operations that can be performed. For example, you can add two integers, but you cannot add two logical values.
  3. The way in which the values are stored in memory. Some datatypes can be stored directly (such as numbers), while others are stored indirectly (such as strings).

By convention, REBOL datatype words are followed by an exclamation point (!) to help make them stand out. For example:

Datatype Words are Just Words

The words used for datatypes are just like any other words in REBOL. There is nothing magic about the ! used to represent them.

Table of common datatypes

Value Summary Example
integer! 64 bit integers
1234 -432
decimal! 64 bit floating point
3.1415 1.23E12 0,01 1,2E12
percent! 64 bit decimal percent
1% 100% 12.34% 1234%
money! arbitrary precision math
$12.34 USD$12.34 CAD$123.45 DEM$1234,56
time! absolute and relative time
12:34 20:05:32 -0:25.34
date! date, time, zone
20-Apr-1998/12:32        ; date and time
20-Apr-1998/12:32-8:00   ; with timezone
tuple! versions, colors, IP addresses
3.1.5           ; version numbers   ; RGBA colors      ; Internet addresses
pair! coordinate pairs
5x10 100x100 -50x-25
string! ASCII and Unicode strings
"Here is a string"
{Here is another way to write
a string that spans many lines
and contains "quoted" strings.}
binary! Encoded strings of bytes
#{0A6B14728C4DBEF5}      ; hex encoded
64#{45kLKJOIU8439LKJklj} ; base-64 encoded
tag! General markup tags (HTML, XML, etc.)
<title> </body>
<font size="2" color="blue">
email! email addresses
file! File names and directory paths
url! Uniform resource locators
issue! Identification and serial strings
#707-467-8000        ; a phone number
#0000-1234-5678-9999 ; a credit card number
#MFG-932-741-A       ; a model number

  TOC < Back Next > - WIP Wiki Feedback Admin