Perl 6 Perl 6 #15

Junctions

A junction is a single value that is equivalent to multiple values.

(1|2|3) + 4              # 5|6|7

Create junctions using "any", "all", "one", and "none", or the infix operators '|' and '&'

unless $roll == any(1..6) { print "invalid roll"; }

if $roll == 1|2|3 { print "Low roll"; }

if none @a == $elem { print "$elem is not in @a"; }
Copyright © 2008 Patrick Michaud