Ch. 5.12: Optional Topics: Breaking and Continuing a Loop Flashcards

1
Q

What is the break statement?

A

A break statement can stop a loop before it goes through all its iterations. When it is encountered, the loop stops, and the program jumps to the statement immediately following the loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the continue statement do?

A

The continue causes the current iteration of a loop to end immediately. When continue is encountered, all the statements in the body of the loop that appear after it are ignored, and the loop prepares for the next iteration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly