Associative array/Creation: Difference between revisions
→{{header|Elixir}}: show map literals
Jazzedpineda (talk | contribs) (Add EasyLang) |
(→{{header|Elixir}}: show map literals) |
||
Line 2,862:
=={{header|Elixir}}==
===Map literals===
An empty map:
<syntaxhighlight lang="elixir">
%{}
</syntaxhighlight>
A map with key-value pairs of different types:
<syntaxhighlight lang="elixir">
%{"one" => :two, 3 => "four"}
</syntaxhighlight>
Maps with atoms as keys:
<syntaxhighlight lang="elixir">
%{a: 1, b: 2}
# equivalent to
%{:a => 1, :b => 2}
</syntaxhighlight>
===Programmatic map creation===
{{trans|Erlang}}
<syntaxhighlight lang="elixir">defmodule RC do
|