Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- subset VLAN of Int where { $^n > 0 && $^n < 4096 };
- sub print-vlan-id ( VLAN:D $vlan ) {
- say "VLAN ID: $vlan";
- }
- sub MAIN () {
- print-vlan-id(1); # OK, prints VLAN ID: 1
- print-vlan-id(1337); # OK, prints VLAN ID: 1337
- print-vlan-id(Nil); # BOOM. Type check failed in binding to parameter '$vlan'; expected Int but got Nil (Nil)
- print-vlan-id(9999); # BOOM. Constraint type check failed in binding to parameter '$vlan'; expected VLAN but got Int (9999)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement