Previous: Conditional execution, Up: Complex statements [Contents][Index]

`FOR`

loops, `LET`

bindings, and `IF`

statements
operate on a single <`simple_stmt`> (or
two <`simple_stmt`>s in
the case of
`IF`

… `OTHERWISE`

). Operating on
multiple <`simple_stmt`>s—or,
more precisely, operating on a single
<`complex_stmt`> that may consist of multiple
<`simple_stmt`>s—is
a simple matter of placing the <`simple_stmt`>s
within curly braces. Contrast the following:

FOR 3 REPETITIONS TASK 0 OUTPUTS "She loves me." THEN TASK 0 OUTPUTS "She loves me not." -| She loves me. -| She loves me. -| She loves me. -| She loves me not. FOR 3 REPETITIONS {TASK 0 OUTPUTS "She loves me." THEN TASK 0 OUTPUTS "She loves me not."} -| She loves me. -| She loves me not. -| She loves me. -| She loves me not. -| She loves me. -| She loves me not.

In other words, everything between ‘`{`’ and
‘`}`’ is treated as if it were a single statement.
Hence, the
`FOR`

loop applies only to the “She loves me” output in
the first statement above, while the `FOR`

loop applies to both “She
loves me” and “She loves me not” in the second statement.

Variable scoping is limited to the
<`simple_stmt`> in the body of a `LET`

:

```
LET year BE 1984 WHILE LET year BE 2084 WHILE TASK 0 OUTPUTS year THEN
TASK 0 OUTPUTS year
error→ The second ‘
````year`’ is outside the scope of both ‘`LET`’ statements.
LET year BE 1984 WHILE {{LET year BE 2084 WHILE TASK 0 OUTPUTS year}
THEN TASK 0 OUTPUTS year}
-| 2084
-| 1984

As indicated by the grammatical rules presented at the beginning
of Complex
statements, coNCePTuaL does support empty pairs of curly
braces, which represent a statement that does nothing and takes no
time to execute. While never strictly needed, ‘`{}`’ may
be a convenient mechanism for mechanically produced coNCePTuaL
programs.

Previous: Conditional execution, Up: Complex statements [Contents][Index]