Rewriting `while` to use iterative evaluation.