Samantha encounters a scenario where she needs to exit out of multiple nested loops upon a particular condition. What programming construct can she use to achieve this efficiently?

  • break
  • continue
  • goto
  • return
Samantha can use the break statement to efficiently exit out of multiple nested loops upon a particular condition. When the break statement is encountered, it terminates the innermost loop and continues executing the code after the loop. It's important to use this construct judiciously to avoid unexpected behavior.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *