Writing a while loop
In this exercise, let's write a while loop in three separate stages. In this situation, we want to purchase a certain amount of stock, defined by the variable stock_required. A second variable stock_owned tracks the amount of stock that we currently own.
Use a while loop to purchase the amount of stock required while also updating the currently owned stock.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Intermediate Julia
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Initialise stock_required and stock_owned
____ = 10
____ = 0