Wiki

Break Statement

The break statement terminates the execution of the nearest enclosing loop in which it appears. Control passes to the statement that follows the terminated statement, if any.

Grammar

break

Example

def main is shared
    for i in 1 : 10
        print i

        if i == 4
            break
    
    # Loop exits after printing 1 through 4