Skip to content

Commit

Permalink
Merge pull request #183 from mknos/arith-prompt
Browse files Browse the repository at this point in the history
arithmetic: make expected prompt appear
  • Loading branch information
briandfoy committed Jul 5, 2023
2 parents b9a578d + 936bf8d commit 14ca7ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/arithmetic
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ while ($questions < QUESTIONS) {
LOOP: {
print "$left $operator $right = ";
chomp ($guess = <>);
print "Please type a number.\n", redo if $guess =~ /\D/;
if ($guess =~ /\D/) {
print "Please type a number.\n";
redo;
}
}

if ($guess == $answer) {
Expand Down Expand Up @@ -152,7 +155,7 @@ sub report {
"$hours hour", "$minutes minute", "$seconds second") ||
"no time at all!";

print "\nYou had $correct answers correct, our of $questions. ",
print "\nYou had $correct answers correct, out of $questions. ",
"It took you $time.\n";

exit $warnings;
Expand Down Expand Up @@ -242,4 +245,3 @@ and sell this program (and any modified variants) in any way you wish,
provided you do not restrict others from doing the same.
=cut

0 comments on commit 14ca7ce

Please sign in to comment.