What is break statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is break statement

Kindly explain with basic example

6th Jan 2021, 1:34 PM
S. V. Shivaani
S. V. Shivaani - avatar
6 Answers
+ 5
Hi use the language name in tag . Break statement will stop further execution of loop .For example in python count=0 while true: print(5) count+=1 if count==6: break the above loop will print 5 five times and when the count is equal to 6 loop will break .
6th Jan 2021, 1:40 PM
Abhay
Abhay - avatar
+ 5
Abhay I think you meant count += 1 or count = count + 1 instead of count++
6th Jan 2021, 1:44 PM
Baspberry
+ 3
FunOfCoding maybe I don't even remember python syntax at all ! Thks for correcting!
6th Jan 2021, 1:47 PM
Abhay
Abhay - avatar
+ 3
Thanks a lot well explained Abhay
6th Jan 2021, 2:06 PM
S. V. Shivaani
S. V. Shivaani - avatar
+ 1
FunOfCoding thanks for the correction
6th Jan 2021, 2:07 PM
S. V. Shivaani
S. V. Shivaani - avatar
0
Please search your question before asking it here.
6th Jan 2021, 2:39 PM
Hardik Sharma
Hardik Sharma - avatar