"if" replaced by "while"