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

While Loop Not Initiating

Joshua
2-Guest

While Loop Not Initiating

Hello,

Although not new to mathcad, I have never attempted anything other than a simple if statement with programming before. Today I decided to use a while loop so that I would not have to show all the iterative calcs written out in mathcad prime 6. Instead of having a condition attached to the while loop (for example "while n>0") I wanted to make my check based on an if statement at the end of the while loop. Essentially I would like the while loop to ALWAYS trigger unless a "break" or "continue" statement is reached within the while loop. I have posted my spreadsheet because I am really not sure how to even begin to guess what the issue is. In the mathcad sheet I wrote all of my initial calcs on the left. When I decided I wanted to condense them using mathcad programming, I developed the program on the right. Note that in the program my iteration check tolerance is based on the norm of the strain vectors which is different from my initial calcs where it was based on the distance to the neutral axis. I am sure you will have questions for me to even answer my question. How can I make this program work? Any help is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:Joshua)

0 > 1 is ALWAYS false, so your while loop is never entered at all!

You may use 0 < 1 to achieve an endless loop,

But as any number despite of zero is considered TRUE in Prime, you may also use "While 1 ..."

View solution in original post

1 REPLY 1
Werner_E
24-Ruby V
(To:Joshua)

0 > 1 is ALWAYS false, so your while loop is never entered at all!

You may use 0 < 1 to achieve an endless loop,

But as any number despite of zero is considered TRUE in Prime, you may also use "While 1 ..."

Top Tags