Ad space (banner)
๐ŸŸฃJulia Lessons
Lesson 68 / 68

[Project] Build a simple inventory system

This lesson covers building a simple inventory system with Julia's Dict, with the aim of combining what you have learned so far into a larger program.

Combine the dictionaries and loops covered so far into a program that manages stock. A Dict looks up and updates values quickly by key, which makes it one of the most frequently used data structures there is.

The sample code builds a stock dictionary with Dict("apple" => 10, "orange" => 5), reduces the stock with items["apple"] -= 3, and lists every product by taking key and value together with for (name, qty) in sort(collect(items)).

A common early stumble is the => dictionary literal. It differs from the colon : of other languages and takes a moment to get used to.

Structs, multiple dispatch, error handling — everything covered in these lessons — carries straight over into real numerical and data-analysis work in Julia as core skills. Well done.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run Julia directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)