เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

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.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Intermediate Julia

ดูคอร์ส

คำแนะนำการฝึกหัด

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

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Loop over stock_tickers and print each element
for value in ____
  ____(____)
end
แก้ไขและรันโค้ด