I was reading the doc of elixir and executing the related codes, everything was fine until this part . This part says:
iex> map = %{:a => 1, 2 => :b}
%{2 => :b, :a => 1}
iex> map[:a]
1
iex> map[2]
:b
But if i do the same in my laptop i get an error:
iex(1)> map = %{:a => 1, 2 => :b}
** (SyntaxError) iex:1: invalid token: %{:a => 1, 2 => :b}
What am i doing wrong?? Any idea?
Elixir version: Elixir 0.10.3
Erlang version: rlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
You have an outdated Elixir version on your laptop (0.10.3). Maps are introduced in version 0.13.0
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.