RosettaCodeData/Task/Associative-array-Creation/Inform-7/associative-array-creation-2.inf
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

15 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.