Overview for dict

Dictionaries in Julia - Beginner's tutorial [with examples]

Dictionary is a kind of Data Structure in many programming languages and it is a part of Julia programming language as well. Let's create a simple example for understand, how Dictionaries work in Julia.

Imagine we have a Car Store and we're selling different cars. Our plan is to create a list of cars with possibility of looking for a price by giving a car's name.

Creating a Dictionary

Creating Dict variable, which will represent our pricelist. As a key we will store the name of a product and as a value we will store its price (let's say in US Dollars):

julia> Pricelist = Dict("Honda" => 12000, "Fiat" => 9800, "Ford" => 11000, "Lambo" => 175000)

You see, the core of a Dictionary is a pair of two values. In our case a name of a car is a key and car's price is a value.

Read more

Written by Administrator on Sunday May 10, 2020