if (($a != b) && ($error > 0 && $error <= 3 )) { repeat question and increment $error++ } if ($a == $b) { print "Correct!\n" print "Only took you $error times!\n"; } if ($error >= 3) { print "Took you too many tries, you lose\n"; }