Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 107 - 2609_Logicode
P. 107

    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:

                     The join block is used to concatenate (combine) two or more pieces of text (strings) together into
                     a single string. This block is particularly useful when you need to create a message or label that
                     combines static text with dynamic values, such as scores or player names.

                     When you run the project, the following output displays the first iteration of the while loop.

                     Now, click on the A button in the Game Controls to view the further output till it reaches the last

                     iteration of the while loop.

                                                                                           Advanced MakeCode Arcade  105

| 102 103 104 105 106 107 108 109 110 111 112 |