Skip to main content
1-Visitor
October 6, 2016
Question

Help with a double "IF" statement

  • October 6, 2016
  • 5 replies
  • 5111 views

Hello.

I'm having trouble combining 2 "IF" statements. I'm sure this is a piece of cake for you experts.

Here is the general form of my program (the actual equations are more complicated).

X=A   If  M=1

X=B   If M=2  and If N=1

X=C  If M=2 and If N=0  (or simply X=C  otherwise)

Thanks, Al Clark

5 replies

23-Emerald IV
October 6, 2016

You're posting this in the general community help section - meaning help with the community site itself, not some specific PTC software.  If you can tell us what software you're using, we can provide a better response.

24-Ruby III
October 6, 2016

Hi,

in case that you need to define model relations, please see following code.

/* M, N are integer values

X=C

if M==1

  X=A

endif

if M==2

  if N==1

    X=B

  endif

endif

MH

19-Tanzanite
October 6, 2016

Since you have posted in the Mathcad forums before I assume this is a Mathcad question, in which case the best solution is a small program:

Note that you cannot just type "return", "if" and "otherwise". They must be entered from the programming toolbar.

Toby Metcalf‌ please move this to the Mathcad forums.

5-Regular Member
October 7, 2016

Thanks Richard

21-Topaz II
October 7, 2016

Hi

Even so, it would be fine, do not you think?

returnif.jpg

aclark-31-VisitorAuthor
1-Visitor
October 8, 2016

Thanks everyone for your help. I didn't realize that I would initiate such a discussion.

Actually all I needed was to be steered to the Boolean "and", and then I was all set.

Regards, Al