Page 92 - Computer Genius Class 06
P. 92

Continue Statement

                  The continue statement  orces the ne t iteration o  the loop to e ecute  and s ips the line o  code
                   ithin the loop.  hile e ecuting a program  i  the program control encounters a continue statement
                  the e ecution o  the remaining statements inside the loop are s ipped  or the current iteration and the
                  control  umps to the  eginning o  the loop  or the ne t iteration. The loop s condition is chec ed again
                  and i  it is true  then the control enters the loop  other ise the control  ill  e mo ed to the statement
                  immediately a ter the loop.


                                            While (Loop-Condition)
                                            {
                                               tatement 1
                                               tatement 2      When the continue  statement
                                              ...........
                                                               comes in  et een the e ecution
                                               ontinue         of the program, it skips the line of
                                              ...........
                                                               code and  umps to the  eginning
                                            }
                                            Statement          o  the loop.



                  Example 2: To print num er  rom   to 2  y using the continue statement   ut does not print  hen
                  the  alue is  .
                  Pseudocode:
                  Program Start

                  set  alue o    to
                   hile   is greater than
                         decrease the  alue o     y 1
                         i   alue o    is e ual to

                         continue
                         display   urrent  aria le is     alue o
                  display  ye
                  Program End

                                                                                   Information Literacy
                         Quest                                                     Technology Literacy



                        i e one  ord ans er to the  ollo ing  uestions.
                       1.    hich logical operator is used to chec  i  either one o  t o or more
                           conditions is T

                       2.   hich logical operator is used to re erse or negate a condition

                        .    hich statement s ips the remaining statements in a loop
                        .    hich statement terminates the e isting loop





                      90     Computer Genius-VI
   87   88   89   90   91   92   93   94   95   96   97