RosettaCodeData/Task/Associative-array-Creation/Crystal/associative-array-creation.crystal

6 lines
280 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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