Table of Contents
In this tutorial, you will learn how vto use the break statement and how to control flow of the loop in Python .
break can be used in both “while” and “for loop“. It controls the flow of the loops(for loop , while loop) and is used to terminate the control of loop.
Syntax
for loop with break in Python
Program 1
1 2 3 4 End of the loop
While loop with break in Python
Program 1
When the above code is executed, The following output is displayed
1 2 3 4
Program 2
When the above code is executed, The following output is displayed
Similar post
for loop with pass break continue statements
while loop with pass break continue statements
Multiply two numbers in Java using scanner| 5 different ways In this article, we will…
5 Different ways to Divide two numbers in Java using scanner In this article, we…
Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…
10 ways to subtract two numbers in Java In this article, we will discuss the…
Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…
How to Divide two numbers in Java| 5 different ways In this article, we will…
This website uses cookies.