6  Dictionaries

Dictinaries can be created using an iterable of 2-tuples of the form (key, value):

x = Dict([("A", 10), ("B", 20)])
Dict{String, Int64} with 2 entries:
  "B" => 20
  "A" => 10

Alternatively, a series of pair arguments can be used:

x = Dict("A" => 10, "B" => 20)
Dict{String, Int64} with 2 entries:
  "B" => 20
  "A" => 10

To specify types:

x = Dict{String, Float64}("A" => 10, "B" => 20)
Dict{String, Float64} with 2 entries:
  "B" => 20.0
  "A" => 10.0

6.1 Nested dictionary

x = Dict(
    "A" => [3, 5, 7],
    "Meta" => Dict(
        "ID" => "super", 
        "Origin" => "345"
    )
)
x
Dict{String, Any} with 2 entries:
  "Meta" => Dict("Origin"=>"345", "ID"=>"super")
  "A"    => [3, 5, 7]

6.2 Resources