RosettaCodeData/Task/Associative-array-Creation/Crystal/associative-array-creation.crystal
2023-07-01 13:44:08 -04:00

5 lines
280 B
Text

hash1 = {"foo" => "bar"}
# hash literals that don't perfectly match the intended hash type must be given an explicit type specification
# the following would fail without `of String => String|Int32`
hash2 : Hash(String, String|Int32) = {"foo" => "bar"} of String => String|Int32