WHILEconditionlist
instructionlist
Repeatedly evaluates the instructionlist
as long as the evaluated conditionlist
remains TRUE.
WHILE evaluates conditionlist
before instructionlist
, so instructionlist
may not be run at all.
The conditionlist
input must contain an expression that evalautes to either TRUE or FALSE.
The fact that the conditionlist
input is a list may be misleading, because it should contain exactly one expression.
It is only a list because the contents of a list are not evaluated by default.
Instead, they must be explicitly evaluated with RUN.
This allows Logo to reevaluate conditionlist
after each iteration, rather than only evaluating it once.
MAKE "i 0
WHILE [:i<3] [MAKE "i :i+1 PRINT :i]
1
2
3