while

(while test_expression expression1 ...)

The while construct allows iteration to continue until the specified expression evaluates to nil.

The function returns the result of the last expression evaluated.

Example

: (setq x 0)

0

: (while (< x 5) (princ "X=")(princ x)(terpri) (setq x (+ x 1)))

X=0

X=1

X=2

X=3

X=4

5