What is the difference between break and exit | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between break and exit

support your answer with a program

13th Sep 2017, 6:14 AM
harsh goyal
harsh goyal - avatar
2 Answers
+ 3
break is halting "temporarily" your statement , usually in conditional If...Then...Else... and Loop... exit(0) force closed your entire code regardless where you put the exit code..
13th Sep 2017, 6:29 AM
Mikhael Anthony
Mikhael Anthony - avatar
+ 1
It is also used in switch statement ;)
13th Sep 2017, 6:31 AM
Drax
Drax - avatar