Page 81 - Code Craft Computer-8
P. 81

The Continue Statement

            The continue statement is used inside loops. When a continue statement is encountered inside a
            loop, control of the program jumps to the beginning of the loop for next iteration, skipping the
            execution of rest of the statements of the loop for the current iteration.
            Syntax:
            #loop statements

            continue
            #the code to be skipped

            Program 10: To demonstrate the use of the continue statement in a loop.




















            On running the program, we get the following output:
































                          Flashback Time


                    ¨  In Python, the statements that are used to repeat a set of instructions are called iterative  or
                       looping statements.
                    ¨  Looping statements are very useful and necessary for developing various applications.
                    ¨  Python provides two types of looping statements— for and while.



                                                                 81
   76   77   78   79   80   81   82   83   84   85   86