Data Structures · 4.1
Arrays
All lessons are open — jump whenever you need.
Arrays are 0-indexed (like C/JavaScript):
let nums = [1, 2, 3, 4, 5]
print(nums[0]) // 1
print(nums.len()) // 5
let doubled = nums.map(|x| x * 2)
let filtered = nums.filter(|x| x > 2)Goal: Create an array with [10, 3, 7, 1, 9], sort it and print the smallest and largest element.
lesson-4-1.zolo
Program output
Run the code to see the output