Page 105 - TP-Play_V-2.0_Book-8
P. 105

Program 6: To demonstrate the use of the break statement in a loop


















            On running the above program, we get the following output:
























            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.
            The syntax of the continue statement:

            #loop statements

                 continue
            #the code to be skipped

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


















                                                                                       Loops in Python      105
   100   101   102   103   104   105   106   107   108   109   110