0

What is break

19th Jan 2017, 2:48 PM
ritesh
4 Respuestas
+ 1
It's manly use to stop a loop. Exemple: for( int i = 0; i < 10; i ++) { if (i == 3) { break; } } In this case we are suppose to loop from 0 to 10 but the break will "break" the process when i == 3.
19th Jan 2017, 2:50 PM
Florian Castelain
Florian Castelain - avatar
+ 1
The BREAK also used to stop, or end the process in FOR loop, DO...WHILE loop, WHILE loop, switch case. Remember in Switch case, if you don't use break, once the value satisfies the condition, all statements after that will be executed until it hits the Break or End of the scope.
19th Jan 2017, 2:56 PM
Thuong Mai
Thuong Mai - avatar
+ 1
to stop your looping
19th Jan 2017, 3:12 PM
Gusti Arya
Gusti Arya - avatar
+ 1
break is used to terminate the process and jump out of the loop without considering the remaining part of the loop
21st Jan 2017, 2:54 PM
Hasib
Hasib - avatar