Appending to a dictionary in Julia

take a look here

“… Because dictionaries don’t store the keys in any particular order, you might want to output the dictionary to a sorted array to obtain the items in order: …”

or try using Dictionaries

using Dictionaries

mphb = Dictionary("Jenny" => "867-5309", "Ghostbusters" => "555-2368")

julia> mphb = Dictionary("Jenny" => "867-5309", "Ghostbusters" => "555-2368")
2-element Dictionary{String, String}
    "Jenny" │ "Ghostbusters"
 "867-5309" │ "555-2368"

insert!(mphb,"Kramer", "555-FILK")

julia> mphb
3-element Dictionary{String, String}
    "Jenny" │ "Ghostbusters"
 "867-5309" │ "555-2368"
   "Kramer" │ "555-FILK"

3 Likes