2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,10 +1,10 @@
|
|||
fruits = [{:apple, 1}, {:banana, 2}, {:cherry, 3}] # Keyword list
|
||||
fruits = [apple: 1, banana: 2, cherry: 3] # Above-mentioned different notation
|
||||
fruits[:apple] #=> 1
|
||||
Dict.has_key?(fruits, :banana) #=> true
|
||||
fruits = [{:apple, 1}, {:banana, 2}, {:cherry, 3}] # Keyword list
|
||||
fruits = [apple: 1, banana: 2, cherry: 3] # Above-mentioned different notation
|
||||
fruits[:apple] #=> 1
|
||||
Keyword.has_key?(fruits, :banana) #=> true
|
||||
|
||||
fruits = %{:apple=>1, :banana=>2, :cherry=>3} # Map
|
||||
fruits = %{apple: 1, banana: 2, cherry: 3} # Above-mentioned different notation
|
||||
fruits[:apple] #=> 1
|
||||
fruits.apple #=> 1 (Only When the key is Atom)
|
||||
Dict.has_key?(fruits, :banana) #=> true
|
||||
fruits = %{:apple=>1, :banana=>2, :cherry=>3} # Map
|
||||
fruits = %{apple: 1, banana: 2, cherry: 3} # Above-mentioned different notation
|
||||
fruits[:apple] #=> 1
|
||||
fruits.apple #=> 1 (Only When the key is Atom)
|
||||
Map.has_key?(fruits, :banana) #=> true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue