What is the purpose of the break statement in loops?

What is the purpose of the break statement in loops?

a) Skips the current iteration
b) Exits the loop immediately
c) Restarts the loop
d) Pauses the loop

Answer:

b) Exits the loop immediately

Explanation:

The break statement is used to exit the loop immediately, regardless of the loop’s condition.

Reference:

R Programming – Loops MCQ Questions and Answers

Scroll to Top