Mathcad if Statements

1
Help Center R Task 2–1: Writing If Statements Task 2–1: Writing If Statements Write a function reverse that modifies the value of its argument from BLACK to WHITE and vice versa. Keep the file open and proceed to Task 2 2 . 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. Search LearningConnector eLearning Knowledge Base Setup Start using Mathcad Prime 2.0 with these free tutorials! 2 recommended topics Mathcad Prime 2.0 - Programming Mathematical Expressions Page 1 of 1 Task 21: Writing If Statements 6/20/2013 http://127.0.0.1:64851/index.jspx?id=resourceid-131-01BE2B6F&action=show

Transcript of Mathcad if Statements

Page 1: Mathcad if Statements

Help Center

Relevance

Task 2–1: Writing If Statements

Task 2–1: Writing If StatementsWrite a function reverse that modifies the value of its argument from BLACK to WHITE and vice versa.

Keep the file open and proceed to Task 2–2.

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.

Search LearningConnectoreLearning Knowledge Base

Setup

Start using Mathcad Prime 2.0 with these free tutorials!

2 recommended topics

Mathcad Prime 2.0 - Programming Mathematical Expressions

Page 1 of 1Task 2–1: Writing If Statements

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