Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created November 21, 2016 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/82b9cc8a3abe481e65523d8f1a3b2734 to your computer and use it in GitHub Desktop.
Save zoffixznet/82b9cc8a3abe481e65523d8f1a3b2734 to your computer and use it in GitHub Desktop.
my @cards = (2, False), ('Jack', False), ('Ace', True), ('Ace', False);
for @cards -> ($face, $aces-high) {
my $value = do given ($face, $aces-high) {
when (/^\d+$/, $) { +$face } # 2..10
when ('Ace', :so) { 11 } # aces high
when ('Ace', :!so) { 1 } # aces low
default { 10 } # face card
}
put "$face ($aces-high) = $value";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment