Page 62 - Computer_Genius_v2.1_C7_flipbook
P. 62

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:



















                      60     Computer Genius (V2.1)-VII
   57   58   59   60   61   62   63   64   65   66   67