123456789101112131415161718192021222324252627282930313233343536 | t := {k=123, v=456}
say "t = $t"
say "t['k'] = $(t["k"])"
say "t['missing'] = $(t.get("missing"))"
fail unless #t == 2
if "k" in t
say "Yep 'k' is there"
else
say "Nope 'k' isn't there"
if "gone" in t
say "Yep 'gone' is there"
else
say "Nope 'gone' isn't there"
say "Setting t['new']=1337"
t["new"] = 1337
say "t = $t"
for k,v in t
say "Entry: t[$k] = $v"
for val in t
say "Just the value: $val"
t_int := {[123]=456, [0]=345, [567]=0}
say "t_int = $t_int"
say "t_int[0] = $(t_int[0])"
say "t_int[123] = $(t_int[123])"
say "t_int[567] = $(t_int[567])"
say "t_int.get(4) = $(t_int.get(4))"
for k,v in t_int
say "Entry: t_int[$k] = $v"
|