Using do in view

Inside the view code block, ordinary binding statements such as n: 2 ** 3 and print n must be placed within a do block, like this:

;-- see Chapter09/container-layout.red:view [    text "Use of do block"    do [n: 2 ** 3 print n]]

A do block can be used to evaluate code and initialize or make changes to the GUI, before the layout is displayed.

All other code must appear within action facet code blocks, such as our button-click code [download-rates].

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.