A block
is a pair of statements that indicate the beginning and end of a syntax
unit. Typically, other statements are nested within the block. GTL
has many specialized block constructs.
/* This is a valid block. No nested statements are required. */
LAYOUT OVERLAY;
ENDLAYOUT;
/* This block has no restrictions on the number of nested statements. */
LAYOUT OVERLAY;
SCATTERPLOT X=height Y=weight;
REGRESSIONPLOT X=height Y=weight;
ENDLAYOUT;
/* This block allows only nested ROWAXIS statements. */
ROWAXES;
ROWAXIS / LABEL="Row 1";
ROWAXIS / LABEL="Row 2";
ENDROWAXES;
/* Blocks support nested blocks */
CELL;
CELLHEADER;
ENTRY "Cell 1";
ENDCELLHEADER;
LAYOUT OVERLAY;
HISTOGRAM weight;
DENSITYPLOT weight;
ENDLAYOUT;
ENDCELL;
Whenever blocks are nested, there exists a "Parent -
Child" relationship. In the previous example, the CELL block is the
parent of the CELLHEADER block and LAYOUT OVERLAY block. This is important
because most blocks have rules about what statements they might contain,
and they also have nesting restrictions. For example, a CELLHEADER
block, if used, must be the direct child of a CELL block. Only one
CELLHEADER block can be used per CELL block. To improve code readability,
nested blocks are indented in source programs.