-
-
Save anonymous/4172935 to your computer and use it in GitHub Desktop.
difference between && and 'and'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use common::sense; | |
sub a { say "a"; 2 } | |
sub b { say "b"; 0 } | |
sub c { say "c"; 1 } | |
sub ok { say "ok"; 3; } | |
sub nok { say "nok"; 4; } | |
my $x = a and b and c and ok or nok; | |
my $y = a && b && c && ok || nok; | |
say "x=$x, y=$y"; | |
__DATA__ | |
output: | |
a | |
b | |
nok | |
a | |
b | |
nok | |
x=2, y=4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment