×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Mathcad15 - If statement false - > previously defined variable deleted or overwritten with 0

Mathcad15 - If statement false - > previously defined variable deleted or overwritten with 0

Mathcad15 - If statement false - > previously defined variable deleted or overwritten with 0

(OP)
Hello everyone,
I have a simple question: when I define an If statement in Mathcad 15 and this If statement is false, the variable used in the If statement is deleted or overwritten with 0. I would like the variable to stay unchanged when the If statement is false.
See for example this case:

Basically I would like the program to return the original value for the variable t (=2).
Any suggestions? Is there maybe some setting that can be changed?
Cheers!

RE: Mathcad15 - If statement false - > previously defined variable deleted or overwritten with 0

variables inside a program are not the same as variables outside a program, You need to define t inside the program



TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

RE: Mathcad15 - If statement false - > previously defined variable deleted or overwritten with 0

(OP)
Hi @IRstuff, thanks for the answer.
It is, although, interesting that if you just call the considered "outer variable" in the program (for whatever reason) before the If statement, the considered variable is not erased or overwritten with zero when the If statement is false:


RE: Mathcad15 - If statement false - > previously defined variable deleted or overwritten with 0

Why would it be? You've written an IF statement that has no ELSE, so nothing happens to t if the IF statement is false. This is one reason programmers avoid naming variables with the same name across function boundaries; it's bound to to confuse the reader and likely to cause mistakes.

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

RE: Mathcad15 - If statement false - > previously defined variable deleted or overwritten with 0

The most natural approach IMHO is this:

Sorry - the huge pic size is due to making the screenshot from a 4K display on a rather small notebook display with a rather large windows scale set. Other forum software would allow for resizing but I found no way to do that here. Am I missing something?
Would be annoying to have to manipulate the pic, resave it and then upload.
Are there plans to change the forum software to allow for directly copying pics from the clipboard w/o having to save them first? Would be much appreciated.



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close