Syntax for a map

Posted: January 30th, 2009 | Author: Mars | Filed under: Reference | Comments Off

Syntax for map/dictionary/hash literals in various languages:


JavaScript:  { "foo" : 1, "bar": 2, "baz": 3}
Ruby:  { "foo" => 1, "bar" => 2, "baz" => 3 }
Python: {"foo":1, "bar":2, "baz":3}
Clojure: {"foo" 1 "bar" 2 "baz" 3}
Perl: ("foo" => 1, "bar" => 2, "baz" => 3)