Why do you have a while loop inside an if statement?