简体   繁体   English

创建地图时本地机器上的不同输出

[英]different output on local michine when creating a Map

I was reading the doc of elixir and executing the related codes, everything was fine until this part . 我正在阅读elixir的文档并执行相关代码,直到这部分一切都很好。 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). 您的笔记本电脑(0.10.3)上有过时的Elixir版本。 Maps are introduced in version 0.13.0 在版本0.13.0中引入了地图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM