How do you interrupt a while loop?

How do you interrupt a while loop?
Answer
Tips
  1. The break statement exits a for or while loop completely. To skip the rest of the instructions in the loop and begin the next iteration, use a continue statement.
  2. break is not defined outside a for or while loop. To exit a function, use return .
 

Tìm kiếm

Back
Top