write a short note on break statement
Answers
Answered by
2
Answer:
A break statement is a loop control statement that is used to terminate the loop
Answered by
3
Question:
Write a short note on break statement.
Answer:
★Break statement in Java
Break Statement is a loop control statement that is used to terminate the loop. As soon as the break statement is encountered from within a loop, the loop iterations stop there, and control returns from the loop immediately to the first
statement after the loop.
Syntax: Break;
Basically, break statements are used in situations when we are not sure about the actual number of iterations for the loop or we want to terminate the loop based on some condition. (see the
diagram)
Break: In Java, the break is majorly used for:
- Terminate a sequence in a switch
- statement (discussed above).
- To exit a loop.
- Used as a “civilized” form of goto.
†______________★_______________†
Thank Üh ♡"
Attachments:
Similar questions