programming-examples/perl/Statement/A program that uses the until statement.pl
2019-11-15 12:59:38 +01:00

12 lines
332 B
Perl

#!/usr/local/bin/perl
print ("What is 17 plus 26?\n");
$correct_answer = 43; # the correct answer
$input_answer = <STDIN>;
chop ($input_answer);
until ($input_answer == $correct_answer) {
print ("Wrong! Keep trying!\n");
$input_answer = <STDIN>;
chop ($input_answer);
}
print ("You've got it!\n");