![]()
break
Sometimes you want to exit a loop immediately as soon as some condition is met. The
breakinstruction exits a loop from any point in its block, bypassing the loop’s condition. Execution resumes at the next statement after the loop. You can use a break instruction with awhile,do, orforloop.This example finds the first value in a string array that is longer than 4 characters.