Using blocks and parens

Words and any type of values can be combined in blocks delimited by square brackets [ ]. A block is of type block!. Here is a block containing data:

;-- Chapter03/blocks.red:[    "Jeff" Jeff@amz.com #213-555-1010    "Bill" billg@ms.com #315-555-1234    "Steve" jobs@apl.com #408-555-4321]

(In the graphical REPL on Windows and macOS, this can be copied and pasted in this layout. On Linux, where there is only a console REPL at the moment, it is not so nicely formatted).

You can convert any argument to a block with to-blockto-block {1 2 3} ;== [1 2 3].

Blocks can also contain code instructions, like this:

loop 10 [prin "hello" print " world"]

In the following code snippet, the first block [site action] contains words, which must ...

Get Learn Red - Fundamentals of Red now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.