Advertisement
cwchen

[Perl 6] given .. when

Oct 5th, 2017
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.24 KB | None | 0 0
  1. my $w = Date.today.day-of-week;
  2.  
  3. given $w {
  4.     when 3 {
  5.         "Hump day".say;
  6.     }
  7.     when 5 {
  8.         "Thank God It's Friday".say;
  9.     }
  10.     when 6..7 {
  11.         "Weekend".say;
  12.     }
  13.     default {
  14.         "Week".say;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement