Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

break statement in Python language

Posted on January 8, 2018September 21, 2019

Table of Contents

  • break statement in Python language
    • break; flow diagram of break in python
    • How to work break in python for loop
    • How to work break in python while loop
    • Related

break statement in Python language

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

break;

flow diagram of break in python

break statement in Python language
break flow diagram

How to work break in python for loop

break statement in Python language
break syntax

How to work break in python while loop

break statement in Python language
break syntax

for  loop with break in Python

Program 1

break statement in Python
break
When the above code is executed, The following output is displayed
1
2
3
4
End of the loop
At the above program, when val == 5, break statement is executed and the control of the loop exits from execution.
Program 2
When the above code is executed, The following output is displayed

While loop with break in Python

Program 1

When the above code is executed, The following output is displayed

1
2
3
4
At above program, when i== 5, break statement is executed and control of the loop exits from execution.

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

Continue in C Language

Continue in Python

Pass statement in Python

Break in C Language

Related

Recent Posts

  • Multiply two numbers in Java using scanner| 5 different ways
  • 5 different ways to Divide two numbers in Java using scanner
  • Learn 8 Ways to Subtract Two Numbers Using Methods in Java
  • 10 ways to subtract two numbers in Java
  • Java Code Examples – Multiply Two Numbers in 5 Easy Ways
  • How to Divide two numbers in Java| 5 different ways

tag

Addition (8) Array (38) C++ language (91) C language (98) c sharp (23) Division (8) Function (29) if else (32) Java language (108) JavaScript (5) loops (138) Multiply (8) Oop (2) patterns (66) PHP (13) Python Language (38) Subtraction (9) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2026 Code for Java c | Powered by SuperbThemes