Skip to content

Commit

Permalink
add another hash op example
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrowder committed Sep 7, 2018
1 parent ac6fff1 commit 715ae5d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/use-hashes.nqp
Expand Up @@ -20,10 +20,15 @@ my $k2 := 'k2';
my $v := nqp::atkey(%h, $k1);
say("value of key $k1 is $v");

# check existence of a key
my $k3 := 'k3';
my $v3 := 3;

# add a new pair
nqp::bindkey(%h, $k3, $v3);

if nqp::existskey(%h, $k2) {
say("key $k2 exists");
# check existence of a key
if nqp::existskey(%h, $k3) {
say("key $k3 exists");
}


Expand Down

0 comments on commit 715ae5d

Please sign in to comment.