0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Elixirの Keyword Lists と Map

Posted at

似ているので覚え書き。

List

iex(1)> list1 = [name: "taji", age: 43, address: "Tokyo"]
[name: "taji", age: 43, address: "Tokyo"]

iex(2)> list1[:address]
"Tokyo"

iex(3)> list2 = [{:name, "taji"}, {:age, 43}, {:address, "Tokyo"}]  
[name: "taji", age: 43, address: "Tokyo"]

iex(4)> list2[:address]
"Tokyo"

Map

iex(1)> map = %{"name" => "taji", "age" => 43, "address" => "Tokyo"}
%{"address" => "Tokyo", "age" => 43, "name" => "taji"}

iex(2)> map["address"]
"Tokyo"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?