Well I am pretty sure you didn't code that yourself. So either you copied it wrongly and that's why the while loop isn't working, or you mistakenly edited it.

I am not sure about this, check with someone else, but I don't think that while loop needs a ";"