λ

2.10: While loops

Standard ML has a while loop defined which may be used in place of recursion or higher order functions, wherein one expression is repeated while a condition holds.

Recursion and higher order functions tend to be preferred, as while only makes sense with a mutable condition, and Standard ML tends to prefer immutability.

(* examples/while.sml *)