Page 104 - Plus V4 with Adobe class 8
P. 104
To come out of the infinite loop, we can either close the program window or press Ctrl + C. This will
break the running of the program. In fact, at any time during the execution of a program in Python, you
can press the key combination Ctrl + C to stop running the program.
JUMP STATEMENTS
Sometimes, there is a situation when the control of the program needs to be transferred out of the
loop body, even if all the values of the iterations of the loop have not been completed. For this purpose,
jumping statements are used in Python. Python offers two jumping statements—break and continue,
which are used within the loop.
The Break Statement
The break is a keyword in Python which is used for bringing the program control out of the loop. The
break statement halts the execution of a loop and program flow switches to the statement after the loop.
A single break statement will break out of only one loop. The syntax of the break statement is shown
below.
Syntax:
#loop statement
break
Program 7: To demonstrate the use of the break statement in a loop.
On running the above program, we get the following output:
Interdisciplinary Learning
#Mathematics
Write a program in Python to find whether the number is prime or not.
#Coding
102 Plus (Ver. 4.0)-VIII

