Changing if to while

continuously checking if the value entered is correct