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

REBOL 3 Concepts: Tour: Values

Pending Revision

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

OLD DOCS

This section is obsolete and being replaced. It is kept only as a source for new content.

A script is written with a sequence of values. A wide variety of values exist and you are familiar with many of them from daily experience.

When possible, REBOL also allows the use of international formats for values such as decimal numbers, money, time, and date.

Contents

Numbers

Numbers are written as integers, decimals, or scientific notation. For example:

1234 -432 3.1415 1.23E12

And can also be written in European format:

123,4 0,01 1,2E12

Times

Time is written in hours and minutes with optional seconds, each separated by colons. For example:

12:34 20:05:32 0:25.345 0:25,345

Seconds can include a decimal sub-second. Times can also include AM and PM appended without intervening spaces:

12:35PM 9:15AM

Dates

Dates are written in either international format: day-month-year or year-month-day. A date can also include a time and a time zone. The name or abbreviation of a month can be used to make its format more identifiable in the United States. For example:

20-Apr-1998 20/Apr/1998 (USA friendly)

20-4-1998 1998-4-20     (international)

1980-4-20/12:32         (date with time)

1998===20/8:32-8:00     (with time zone)

Money

Money is written as an optional international three-letter currency symbol followed by a numeric amount. For example:

$12.34  USD$12.34  CAD$123.45  DEM$1234,56

Tuples

Tuples are used for version numbers, RGB color values, and network addresses. They are written as integers that range from 0 to 255 and are separated by dots. For example:

2.3.0.3.1  255.255.0  199.4.80.7

At least two dots are required (otherwise the number will be interpreted as a decimal value, not a tuple). Example:

2.3.0  ; tuple
2.3.   ; tuple
2.3    ; decimal

Strings

Strings are written in a single-line format or a multiline format. Single-line format strings are enclosed in quotes. Multiline format strings are enclosed in braces. Strings that include quotes, tabs, or line breaks must be enclosed in braces using the multiline format. For example:

"Here is a single-line string"

{Here is a multiline string that
contains a "quoted" string.}

Special characters (escapes) within strings are indicated with the caret character (^). [bad-link:concepts/see.txt] the string section in the Values Chapter for the table of escape sequences.

Tags

Tags are useful for markup languages such as XML and HTML. Tags are enclosed in angle brackets For example:

<title> </body>

<font size="2" color="blue">

Email Addresses

Email addresses are written directly in REBOL. They must include an at sign (@). For example:

info@rebol.com

pres-bill@oval.whitehouse.gov

URLs

Most types of Internet URLs are accepted directly by REBOL. They begin with a scheme name (HTTP for example) followed by a path. For example:

http://www.rebol.com

ftp://ftp.rebol.com/sendmail.r

ftp://freda:grid@da.site.dom/dir/files/

mailto:info@rebol.com

Filenames

Filenames are preceded by a percent sign to distinguish them from other words. For example:

%data.txt

%images/photo.jpg

%../scripts/*.r

Pairs

Pairs are used to indicate spatial coordinates, such as positions on a display. They are used to indicate both positions and sizes. Coordinates are separated by an x. For example:

100x50

1024x800

-50x200

Issues

Issues are identification numbers, such as telephone numbers, model numbers, credit card numbers. For example:

#707-467-8000

#0000-1234-5678-9999

#MFG-932-741-A

Binary

Binary values are byte strings of any length. They can be encoded directly as hexadecimal or base-64. For example:

#{42652061205245424F4C}

64#{UkVCT0wgUm9ja3Mh}


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