in reply to Re: John Guttag's book - 2nd exercise. My attempt in Perl.
in thread John Guttag's book - 2nd exercise. My attempt in Perl.

Now write one that checks 26 vars: $a .. $z

Also, nested ifs count as ORs and ANDs :D

  • Comment on Re^2: John Guttag's book - 2nd exercise. My attempt in Perl.

Replies are listed 'Best First'.
Re^3: John Guttag's book - 2nd exercise. My attempt in Perl.
by tybalt89 (Monsignor) on May 22, 2017 at 22:38 UTC

    No, they don't.

      What kind of troll do u think u r?
      $a = 1; $b = 0; print "OR\n" if $a or $b; print "AND\n" if $a and $b; if ($a) { if ($b) { print "AND\n"; } else { print "OR\n"; } } elsif ($b) { if ($a) { print "AND\n"; } else { print "OR\n"; } }