Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 115 - 2609_Logicode
P. 115

    REVISIT

                      ▶   Loops are fundamental programming constructs that allow you to repeat a set of instructions multiple times.

                      ▶  The repeat loop executes a block of code a specified number of times.

                      ▶   The forever loop is a special loop that runs continuously throughout the entire project.
                      ▶   The for loop is a counting loop, which is useful for situations where you need a counter variable that can be
                         used within the loop.

                      ▶  The while loop runs if a specified condition is true.
                      ▶   Jump statements in programming are used to change the flow of control by skipping, starting again or
                         exiting certain parts of the code.
                      ▶   The break statement changes the normal flow of execution of the statement by exiting the existing loop and
                         continuing the flow of the statement after that loop.

                      ▶   The continue statement forces the next iteration of the loop to execute and skips the line of code within the
                         loop.
                      ▶  Functions are reusable blocks of code that perform specific tasks.

                     1.  Tick ( ) the correct option.
                        a.  Which type of block runs a code a specific number of times?

                             (i)  forever block                               (ii)  while block
                            (iii)  break block                               (iv)  repeat block

                        b.  The forever loop is mainly used for:
                             (i)  Running code only once
                            (ii)  Running code until a condition becomes false
                            (iii)  Repeating an action a specific number of times

                           (iv)  Continuously running a block of code without stopping
                        c.   The break statement is used to:
                             (i)  Skip to the next iteration of a loop

                            (ii)  Exit a loop before it completes
                            (iii)  Repeat a block of code a specific number of times
                           (iv)  Continuously run a block of code without stopping

                                                                                           Advanced MakeCode Arcade   113

| 110 111 112 113 114 115 116 117 118 119 120 |