Bắt đầu ngayBắt đầu miễn phí

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.

Bài tập này là một phần của khóa học

Intermediate Julia

Xem khóa học

Hướng dẫn bài tập

  • Write a for loop to iterate over the vector stock_tickers, printing each element of the vector on a new line.

Bài tập tương tác thực hành trực tiếp

Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.

# Loop over stock_tickers and print each element
for value in ____
  ____(____)
end
Chỉnh sửa và Chạy Mã