Data Structures · 4.2
Maps
All lessons are open — jump whenever you need.
let scores = Map::new()
scores.set("Alice", 95)
scores.set("Bob", 87)
print(scores.get("Alice")) // 95
print(scores.has("Charlie")) // false
for key in scores.keys() {
print("{key}: {scores.get(key)}")
}Goal: Create a map of capitals and print the capital of Brazil.
lesson-4-2.zolo
Program output
Run the code to see the output