What you want is an 'until' loop:
http://www.techotopia.com/index.php/Ruby_While_and_Until_Loops#unless_and_until

"until the input is correct, keep looping."