cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Nesting if then conditional logic

SB_11029093
1-Newbie

Nesting if then conditional logic

I am using Mathcad Prime Release 7.0 and Datecode7.0.0.0

How do i use nesting if then statements for functions? I haven't used this product in a while and can't figure out how to break out of the initial if statement to set up a second one. Is there a guide to this somewhere? can't figure out which buttons to press 😐

3 REPLIES 3

Not sure what the problem is.

You start creating a program by typing ] (or use the menu

Werner_E_0-1713470032737.png

Then you can add program lines by typing Shift-Enter

When you are about to insert an if-statement , just do it. You can use the menu, the keyboard short cut (deoends on your keyboard language) or, very convenient, simply TYPE "if" (without the quotes) and follow by pressing Ctrl-J.

Now you can again add lines by pressing Shift Enter and when you are about to insert the inner if-statement, do it using one of the methods described before. And again you can add lines via Shift-Enter.

Werner_E_1-1713470450033.png

To break out from the inner if-statement, you use left-arrow followed by  Enter (or Shift-Enter).

Now you are in the outer for-loop again.

Werner_E_2-1713470552524.png

Documentation is the online help only.

Maybe it helps to read this section of the tutorials -> https://support.ptc.com/help/mathcad/r7.0/en/#page/PTC_Mathcad_Help%2Ftask2-1_Writing_If_Statements.html%23

 

EDIT: But then, maybe you don't really mean "nested" if's. So you may have a look at "also if" and "else if".
If its still unclear, you should post examples of what you would like to accomplish

 

 

 

There is both a function if() and a program operator if.

Note: Type the if() function i f (. do not type the program operator i f. instead insert respective Math Programming operator from ribbon.

 

More examples including nesting are in this Technical Support article:

Article - CS416000 - What is the if() function compared to programming if operator about in Mathcad or Mathcad Prime (ptc.com)


do not type the program operator i f. instead insert respective Math Programming operator from ribbon.

Or you actually DO TYPE  if  and then press Ctrl-J. A very convenient way to insert program statements, especially given that Prime still does not provide other means like floating palettes as in real Mathcad.

Top Tags