Skip to content

Instantly share code, notes, and snippets.

@JustThisGuyAZ
Last active July 16, 2018 00:42
Show Gist options
  • Save JustThisGuyAZ/da906dc837f8c664e10a3e17b9748d22 to your computer and use it in GitHub Desktop.
Save JustThisGuyAZ/da906dc837f8c664e10a3e17b9748d22 to your computer and use it in GitHub Desktop.
Exists test on multidimensional hash
my %node;
%node<1><2> = 1;
for 0..3 -> Int $x {
for 0..3 -> Int $y {
my Int $cost;
say "$x,$y";
$cost = %node<$x><y>:exists ?? 100 !! 1;
say $cost;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment