Programming Tutorial > Task 3–3: Writing Try-On-Error Statements
  
Task 3–3: Writing Try-On-Error Statements
Use try-on-error to specify what should be done if an error occurs while the program is executed. For example, dividing a number by 0 is an error.
1. Define function f(x).
2. To insert a try/on error statement, on the Math tab, in the Operators and Symbols group, click Programming, and then click try.
3. Type 1/2–x.
The try block is the function PTC Mathcad performs when no error occurs. It can contain several expressions.
4. Place the cursor inside the on error block, and on the Math tab, in the Operators and Symbols group, click Constants, and then select infinity ().
5. Evaluate f(x) for various values of x as shown below.
Congratulations! You have completed the Programming Tutorial.