Programming Guide



break

Stops loop execution

Synopsis

break [intConstant]

Arguments

intConstant
The number of nested loops to stop, where a value of 1 specifies the current loop. If you omit this argument, break exits the current loop.

Description

The break command stops execution of the current while or for loop. If the current loop is nested inside one or more other loops, and intConstant is greater than 1, break stops execution of the specified number of outer loops. If intConstant is greater than or equal to the number of loops currently being executed, JPL stops each loop until it exits the outermost one.

Example

// Concatenate address and execute function for 100 entries.
// If cities[i] is empty stop executing the loop.
//
vars i, address, total
for i = 1 while i <= 100
{
if cities[i] == ""
break
address = cities[i]##", "##states[i]##" "##zips[i]
call do_process (address)
}
total = i - 1
msg emsg "Done! :total addresses processed."

See Also

for, next, while