Page 69 - Dig_CodeAI_V2.1_Class_8
P. 69
When you run the project, the following output displays the first iteration of the for loop.
Now, click on the A button in the Game Controls to view the further output till it reaches the last
iteration of the for loop.
While Loop
The while loop runs if a specified condition is true. This type of loop is useful when the number of
iterations depends on a dynamic condition rather than a fixed count. Using while loops allows for
actions and tasks that repeat until certain conditions are met.
Let us create a project in MakeCode Arcade that demonstrates the use of while block to display the
table of 2. Prepare the project in MakeCode Arcade as shown below:
Advanced MakeCode Arcade 67

