RosettaCodeData/Task/Associative-array-Creation/Inform-7/associative-array-creation-...

16 lines
417 B
INI

Hash Bar is a room.
When play begins:
let R be a various-to-one relation of texts to numbers;
[initialize the relation]
now R relates "foo" to 12;
now R relates "bar" to 34;
now R relates "baz" to 56;
[check values]
if R relates "foo" to 12, say "good.";
if R does not relate "bar" to 56, say "good.";
[retrieve values]
let V be the number that "baz" relates to by R;
say "'baz' => [V].";
end the story.