daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Feb 24th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. subset VLAN of Int where { $^n > 0 && $^n < 4096 };
  2.  
  3. sub print-vlan-id ( VLAN:D $vlan ) {
  4.     say "VLAN ID: $vlan";
  5. }
  6.  
  7. sub MAIN () {
  8.  
  9.     print-vlan-id(1); # OK, prints VLAN ID: 1
  10.     print-vlan-id(1337); # OK, prints VLAN ID: 1337
  11.     print-vlan-id(Nil); # BOOM. Type check failed in binding to parameter '$vlan'; expected Int but got Nil (Nil)
  12.     print-vlan-id(9999); # BOOM. Constraint type check failed in binding to parameter '$vlan'; expected VLAN but got Int (9999)
  13.  
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top