Use a for-loop for repeated tasks and to iterate over arrays.
foods = ["melon", "apple", "berry", "orange"]
# Loop through the items in an array
for f in foods
println("Food item is $f")
end
# Loop through a sequence of numbers
for x in 1:10
println("x is $x")
end
Gavin Wiggins © 2024.
Made on a Mac with Genja. Hosted on GitHub Pages.