SlideShare a Scribd company logo
10
Most read
Prepared by
V.Kumararaja, AP/IT
Thangaprasath, AP/CSE
PMC TECH, Hosur
1
LOOP CONTROL
STATEMENTS
Loop control statements change execution from
its normal sequence. When execution leaves a
scope, all automatic objects that were created
in that scope are destroyed. Python supports
the following control statements.
2
 break
 continue
 pass
• The break statement
The break statement terminates the loop
containing it. Control of the program flows to
the statement immediately after the body of
the loop.
If break statement is inside a nested loop (loop
inside another loop), break will terminate the
innermost loop.
Syntax
break
3
Flowchart of break The working of break
statement
4
• Python break program
for val in "string":
if val == "i":
break
print(val)
print("The end")
5
OUTPUT
s
t
r
The end
• Python continue statement
• The continue statement in Python returns the
control to the beginning of the while loop.
The continue statement rejects all the
remaining statements in the current iteration
of the loop and moves the control back to the
top of the loop.
• The continue statement can be used in
both while and for loops.
Syntax
continue
6
7
Flowchart of continue The working of continue
for val in "string":
if val == "i":
continue
print(val)
print("The end")
Python continue statement
OUTPUT
s
t
r
n
g
The end
• Python pass statement
• The pass statement in Python is used when a
statement is required syntactically but you do
not want any command or code to execute.
• The pass statement is a null operation; nothing
happens when it executes. The pass is also
useful in places where your code will
eventually go, but has not been written yet
(e.g., in stubs for example):
Syntax
pass
9
• Example program
for letter in 'Python':
if letter == 'h':
pass
print 'This is pass block'
print 'Current Letter :', letter
print "Good bye!"
10
OUTPUT
Current Letter : P
Current Letter : y
Current Letter : t
This is pass block
Current Letter : h
Current Letter : o
Current Letter : n
Good bye!

More Related Content

PPTX
Input and Output In C Language
PDF
Introduction to the theory of computation
PPTX
Conditional statement c++
PPSX
PDF
Character Array and String
PDF
Programing fundamentals with C++
PPTX
This pointer
PPT
Lecture 5 - Structured Programming Language
Input and Output In C Language
Introduction to the theory of computation
Conditional statement c++
Character Array and String
Programing fundamentals with C++
This pointer
Lecture 5 - Structured Programming Language

What's hot (20)

PPT
Computer languages 11
PPTX
Templates in c++
PPT
Lexical analyzer
PPTX
Python idle introduction(3)
PPSX
Break and continue
PDF
Java Collection framework
PPTX
PPTX
Theory of Computation "Chapter 1, introduction"
PPT
History of c++
PPTX
Looping statement in python
PDF
file handling c++
PPTX
Nltk
PPT
1. over view and history of c
PDF
PPT
PPTX
0.0 Introduction to theory of computation
PPTX
Programming Languages: Trends for 2021
PPTX
[OOP - Lec 01] Introduction to OOP
PPTX
c++ programming Unit 2 basic structure of a c++ program
PDF
StringTokenizer in java
Computer languages 11
Templates in c++
Lexical analyzer
Python idle introduction(3)
Break and continue
Java Collection framework
Theory of Computation "Chapter 1, introduction"
History of c++
Looping statement in python
file handling c++
Nltk
1. over view and history of c
0.0 Introduction to theory of computation
Programming Languages: Trends for 2021
[OOP - Lec 01] Introduction to OOP
c++ programming Unit 2 basic structure of a c++ program
StringTokenizer in java
Ad

Similar to Loop control structure (20)

PPTX
break continue and pass statement in python.pptx
PPTX
Python Flow Control
PPTX
break continue and pass in python progran.pptx
PPTX
a1 this is in python that has break continue and pass.pptx
PDF
Break, Continue and Pass in Python.pdf
PPT
Python session3
PDF
python program
PPTX
Python decision making_loops_control statements part8
PDF
E-Notes_3721_Content_Document_20250107032537PM.pdf
PPTX
control statements in python.pptx
PPTX
introduction to loops in python/python loops
PPTX
Loops in python.pptx/ introduction to loops in python
PPTX
Break,Pass and Continue.pptx
PPTX
This is all about control flow in python intruducing the Break and Continue.pptx
DOCX
Python unit 3 and Unit 4
PPTX
PPTX
python ppt.pptx
PPTX
Python session3
PPTX
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
break continue and pass statement in python.pptx
Python Flow Control
break continue and pass in python progran.pptx
a1 this is in python that has break continue and pass.pptx
Break, Continue and Pass in Python.pdf
Python session3
python program
Python decision making_loops_control statements part8
E-Notes_3721_Content_Document_20250107032537PM.pdf
control statements in python.pptx
introduction to loops in python/python loops
Loops in python.pptx/ introduction to loops in python
Break,Pass and Continue.pptx
This is all about control flow in python intruducing the Break and Continue.pptx
Python unit 3 and Unit 4
python ppt.pptx
Python session3
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
Ad

Recently uploaded (20)

PPT
Mechanical Engineering MATERIALS Selection
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPT
Project quality management in manufacturing
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Well-logging-methods_new................
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Sustainable Sites - Green Building Construction
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Construction Project Organization Group 2.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
web development for engineering and engineering
Mechanical Engineering MATERIALS Selection
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
R24 SURVEYING LAB MANUAL for civil enggi
Project quality management in manufacturing
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Well-logging-methods_new................
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
OOP with Java - Java Introduction (Basics)
UNIT 4 Total Quality Management .pptx
Digital Logic Computer Design lecture notes
CYBER-CRIMES AND SECURITY A guide to understanding
Sustainable Sites - Green Building Construction
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Construction Project Organization Group 2.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
web development for engineering and engineering

Loop control structure

  • 1. Prepared by V.Kumararaja, AP/IT Thangaprasath, AP/CSE PMC TECH, Hosur 1 LOOP CONTROL STATEMENTS
  • 2. Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. Python supports the following control statements. 2  break  continue  pass
  • 3. • The break statement The break statement terminates the loop containing it. Control of the program flows to the statement immediately after the body of the loop. If break statement is inside a nested loop (loop inside another loop), break will terminate the innermost loop. Syntax break 3
  • 4. Flowchart of break The working of break statement 4
  • 5. • Python break program for val in "string": if val == "i": break print(val) print("The end") 5 OUTPUT s t r The end
  • 6. • Python continue statement • The continue statement in Python returns the control to the beginning of the while loop. The continue statement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop. • The continue statement can be used in both while and for loops. Syntax continue 6
  • 7. 7 Flowchart of continue The working of continue
  • 8. for val in "string": if val == "i": continue print(val) print("The end") Python continue statement OUTPUT s t r n g The end
  • 9. • Python pass statement • The pass statement in Python is used when a statement is required syntactically but you do not want any command or code to execute. • The pass statement is a null operation; nothing happens when it executes. The pass is also useful in places where your code will eventually go, but has not been written yet (e.g., in stubs for example): Syntax pass 9
  • 10. • Example program for letter in 'Python': if letter == 'h': pass print 'This is pass block' print 'Current Letter :', letter print "Good bye!" 10 OUTPUT Current Letter : P Current Letter : y Current Letter : t This is pass block Current Letter : h Current Letter : o Current Letter : n Good bye!