Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
+1 vote
190 views
in Computer by (45.2k points)
closed by

Break Statement.

1 Answer

+1 vote
by (44.9k points)
selected by
 
Best answer

The break statement modifies the normal flow of execution while it terminates the existing loop and continues execution of the statement following that loop. Break statement is required as sometimes you want to break out of a loop early when a condition is met. 

Let us now understand Break Statement with help of below pseudocode:

Break Statement

As we see the control skips the lines after the break statement and executes the first statement outside the loop.

Example – Use break statement to print number from 9 to 5 and another print statement when you encounter break 

The pseudo code for this will look like below:

a = 9 
while a > 0: 
  print 'Current variable is :', a 
  a = a -1 
  if a == 5: 
     break 
print "Bye!"

This is the result for the code

Current variable is : 9 

Current variable is : 8 

Current variable is : 7 

Current variable is : 6 

Bye!

Related questions

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...