implementing `while`