Page 102 - Digicode_AI_class_6
P. 102

Continue Statement
            The continue statement forces the next iteration of the loop to execute, and skips the line of code
            within the loop. While executing a program, if the program control encounters a continue statement,
            the execution of the remaining statements inside the loop are skipped for the current iteration and the
            control jumps to the beginning of the loop for the next iteration. The loop’s condition is checked again
            and if it is true, then the control enters the loop, otherwise the control will be moved to the statement
            immediately after the loop.



                                      While (Loop-Condition)
                                      {
                                        Statement 1;
                                        Statement 2;     When  the  continue  statement
                                        ...........
                                                         comes in between the execution
                                        Continue;        of the program, it skips the line of
                                        ...........
                                                         code and jumps to the beginning
                                      }
                                      Statement          of the loop.



            Example 2: To print number from 9 to 2 by using the continue statement, but does not print when
            the value is 4.
                                                                                      Information Literacy
            Pseudocode:

            Program Start
            set value of b to 9
            while b is greater than 0
                   decrease the value of b by 1

                   if value of b is equal to 4
                   continue
                   display 'Current variable is: ' value of b
            display Bye!

            Program End
                                                                             Information Literacy
                   code Quest                                                Technology Literacy



                 Give one word answer to the following questions.
                 1.   Which logical operator is used to check if either one of two or more
                     conditions is TRUE?

                 2.  Which logical operator is used to reverse or negate a condition?

                 3.   Which statement skips the remaining statements in a loop?
                 4.   Which statement terminates the existing loop?





                100    DigiCode AI-VI
   97   98   99   100   101   102   103   104   105   106   107