The Dict()
constructor is used to create dictionaries in Julia. A dictionary is constructed using key value pairs separated with =>
or as tuples.
# Dictionary using key => value
contacts = Dict("Bart" => 14, "Marge" => 39, "Homer" => 44)
# Dictionary using (key, value)
contacts2 = Dict([("Lisa", 16), ("Krusty", 28)])
Computing with Julia © 2023
Built by Gavin Wiggins