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
Computing Julia © 2025
Built with Genja by Gavin Wiggins