Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added more comparison exampel (stole one from jnthn++ slide)
  • Loading branch information
lichtkind committed Dec 16, 2015
1 parent 57447dc commit da7c5e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/appendix-e-exciting.txt
Expand Up @@ -61,11 +61,13 @@ thing" when the arrays have different lengths.
Comparison
==========

Here are junctions, then chained comparison operators.
Here are junctions, then chained comparison operators, than smartmatch with range and defined-or.

Perl 5 Perl 6
if ($a == 3 or $a == 4 or $a == 7) {...} if $a == 3 | 4 | 7 {...}
if (4 < $a and $a < 12) {...} if 4 < $a < 12 {...}
if ($a == 3 or $a == 4 or $a == 7) {...} if $a ~~ 3 , 4 , 7 {...}
if ($g > $limit1 and $g > $limit2) {... if $g > $limit1 & $limit2 { ...
if (4 < $a and $a <= 12) {...} if 4 < $a <= 12 {...}
if (4 < $a and $a <= 12) {...} if $a ~~ 4^..12 {...}
$a = defined $b ? $b : $c; $a = $b // $c;

Expand Down

0 comments on commit da7c5e0

Please sign in to comment.