Page 80 - Touchcode_C6_Flipbook
P. 80

Continue Statement
                  The continue statement forces

                  the next iteration of the loop               While (Loop-Condition)
                  to execute, and skips the line               {  Statement 1;
                  of code within the loop. While                  Statement 2;     When  the  continue  statement
                  executing  a program, if  the                   ...........      comes in between the execution

                  program control  encounters                     Continue;        of the program, it skips the line of
                                                                  ...........
                  a  continue  statement, the                  }                   code and jumps to the beginning
                                                                                   of the loop.
                  execution  of  the  remaining                Statement
                  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.

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

                  Pseudocode:

                  Program Start
                  set value of b to 9
                  while b is greater than 1

                         If value of b is equal to 4
                         Decrease the value of b by 1
                         Continue
                  Display "Current variable is: " value of b

                         Decrease the value of b by 1
                  display Bye!
                  Program End

                    Coding           uiz   02
                                                                                                        Critical Thinking


                      Give one word answer to the following questions.

                      a.  Which statement skips the remaining statements in a loop?    .................................

                      b.  Which statement terminates the existing loop?                      ..................................









                   78     Touchcode-VI
   75   76   77   78   79   80   81   82   83   84   85