in reply to while question

the funyy thing is that the answer is wrong if i dont explicity ignore the last line