Loop over a vector
In the video, you saw how a for loop can be used to easily and efficiently iterate over an iterable structure. In this example, let's practice this by iterating over a vector using a for loop to print all the elements of that vector to the console.
This exercise is part of the course
Intermediate Julia
Exercise instructions
- Write a
forloop to iterate over the vectorstock_tickers, printing each element of the vector on a new line.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Loop over stock_tickers and print each element
for value in ____
____(____)
end