in reply to if/while/else problem
However, that being said, the while loop appears to be terminated by the else clause, aka you're a } missing !