0% found this document useful (0 votes)
3K views

Mathcad If Statements

The document provides instructions for writing if statements in Mathcad Prime 2.0. It explains how to (1) create a function that accepts a variable, (2) add an if statement to check if the variable is equal to "BLACK" and return "WHITE", and (3) add another if statement to return "BLACK" if the variable is equal to "WHITE". The document demonstrates how to call the reverse function to change the value of a variable from black to white or vice versa.

Uploaded by

sebastian9033
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views

Mathcad If Statements

The document provides instructions for writing if statements in Mathcad Prime 2.0. It explains how to (1) create a function that accepts a variable, (2) add an if statement to check if the variable is equal to "BLACK" and return "WHITE", and (3) add another if statement to return "BLACK" if the variable is equal to "WHITE". The document demonstrates how to call the reverse function to change the value of a variable from black to white or vice versa.

Uploaded by

sebastian9033
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Task 21: Writing If Statements

Page 1 of 1

Help Center

Task 21: Writing If Statements

eLearning
2 recommended topics

Knowledge Base

Search LearningConnector

Mathcad Prime 2.0 - Programming Mathematical Expressions


Setup

Relevance

Start using Mathcad Prime 2.0 with these free tutorials!

Task 21: Writing If Statements


Write a function reverse that modifies the value of its argument from BLACK to WHITE and vice versa. 1. Create a new function reverse that accepts a variable var.

2. To add an if statement, on the Math tab, in the Operators and Symbols group, click Programming. The programming operators list opens. Click if.

Note You can type the name of a programming operators, such as "if, and then press Ctrl+J to convert the name to a programming operator with all its placeholders. 3. Condition that if the value of var is BLACK, the function returns the value WHITE as shown below. To add the Boolean equal operator for comparison, on the Math tab, in the Operators and Symbols group, click Operators. The operators list opens. Click = Equal To.

4. To add another if statement, position the cursor as shown below and press Enter.

If the cursor is positioned right after WHITE and you press Enter, Mathcad adds a line inside the if block. 5. Specify the opposite case as shown below.

Note Mathcad supports nested if statements. 6. Call reverse and change the value of a variable myvar as shown below.

Keep the file open and proceed to Task 22.

http://127.0.0.1:64851/index.jspx?id=resourceid-131-01BE2B6F&action=show

6/20/2013

You might also like