Evaluate expression/s while some condition remains true
Control construct. Where
testis an expression that evaluates to an atom of integral type
test evaluates to zero, the expressions
en are evaluated, in order. The cycle – evaluate
test, then the expressions – continues until
test evaluates to zero.
q)r:1 1 q)x:10 q)while[x-:1;r,:sum -2#r] q)r 1 1 2 3 5 8 13 21 34 55 89
The result of
while is always the generic null.
while is not a function but a control construct. It cannot be iterated or projected.
The brackets of the expression list do not create lexical scope. Name scope within the brackets is the same as outside them.