Operators > Programming Operators > Operators for Exiting Loops and Programs
  
Operators for Exiting Loops and Programs
Operator
Description
Skips the remainder of the current iteration and returns to the first loop statement. This operator takes no arguments.
In a for loop, the iteration variable is incremented.
In conjunction with a conditional statement, the continue operator causes the program to skip the current iteration and proceed to the next one.
Halts execution of the current loop and returns the last value calculated. This operator takes no arguments.
In conjunction with a conditional statement, the break operator causes the program to halt the execution of a loop and to return control to the first statement after the loop.
Halts the program and returns x.
Operands
x is any valid PTC Mathcad expression.
Additional Information
You can type the name of a programming operator and then press Ctrl+J to convert the name to a programming operator with all its placeholders.
You must insert the break or continue operator after any expressions that you want to evaluate independently of the stopping condition. For example, when you use continue in a while loop, remember to increment the iteration variable before executing the continue. Failure to do so causes an infinite loop when you evaluate the program.
You can use the return operator for several purposes. For example:
On the last line of a program for identifying the return value visually.
For forcing the return of a base value and preventing further recursion.
For avoiding "fall-through" in conditional statements.
For debugging a program. You can add and remove the return operator to check the value of local variables during program execution.