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

REBOL 3 Guide: Data: Blocks of data

REBOL Expressions are based on this concept: you combine values and words into blocks.

In scripts, a block is normally enclosed with square brackets [ ]. Everything within the square brackets is part of the block. The block contents can span any number of lines, and its format is completely freeform. The following examples show various ways of formatting block content:

[white red green blue yellow orange black]

["Spielberg" "Back to the Future" 1:56:20 MCA]

    "Bill"  billg@ms.dom  #315-555-1234
    "Steve" jobs@apl.dom  #408-555-4321
    "Ted"   ted@gw2.dom   #213-555-1010

sites: [ [save %reb.html data]   [print data]  [send data]

Some blocks do not require square brackets, because they are implied. For example, in a REBOL script, there are no brackets around the entire script, however, the script content is a block. The square brackets of an outer-block of the script are implied. The same is true for expressions typed at the command prompt or for REBOL messages sent between computers--each is an implied block.

Another important aspect of blocks is that they imply additional information. Blocks group a set of values in a particular order. That is, a block can be used as a data set as well as a sequence. This will be described in more detail in the series Chapter. =!

  TOC < Back Next > - WIP Wiki Feedback Admin