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

REBOL 3 Concepts: Blocks: Blocks of Blocks

Pending Revision

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

When a block appears as a value within another block, it counts as a single value regardless of how many values it contains. For example:

values: [
    "new" [1 2]
    %file1.txt ["one" ["two" %file2.txt]]
]
probe values
["new" [1 2] %file1.txt ["one" ["two" %file2.txt]]]

The length? of values is four. The second and fourth values are counted as single values:

print length? values
4

The block values within the values block can be used as a block as well. In the following examples, second is used to extract the second value from values.

To print the block, type:

probe second values
[1 2]

To get the length of the block, type:

print length? second values
2

To print the datatype of the block, type:

print type? second values
block

In the same way, series operations can be performed on other types of series values in blocks. In the following examples, pick is used to extract %file1.''txt from values.

To look at the value, type:

probe pick values 3
%file1.txt

To get the length of the value:

print length? pick values 3
9

to see the datatype of the value:

print type? pick values 3
file


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