Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi All,
I am trying to use a While Loop with two conditions, something like below:
while (x > 10) ^ (y < 100)
...
but Mathcad 15 only goes through the loop once and does not execute the iterations. If I use only one condition check, it works fine. Could someone let me know if it is correct to do what I show above?
Thank you.
Solved! Go to Solution.
Thanks Werner_E, for your quick response. One of the two conditions is a loop counter. I inadventantly initialized it outside the solve block. After I moved this initialzation into the solve block, it works now. I do not know why that would make a difference. Thanks again,
Obviously one of your two conditions linked with logical 'and' is not fulfilled after the first loop pass, so that no further passes are made.
To get a qualified answer to your question, you would have to specify in more detail what exactly you are doing and, of course, attach your worksheet here.
Thanks Werner_E, for your quick response. One of the two conditions is a loop counter. I inadventantly initialized it outside the solve block. After I moved this initialzation into the solve block, it works now. I do not know why that would make a difference. Thanks again,
@LC_12355277 wrote:
Thanks Werner_E, for your quick response. One of the two conditions is a loop counter. I inadventantly initialized it outside the solve block. After I moved this initialzation into the solve block, it works now. I do not know why that would make a difference. Thanks again,
Frankly, I can't make much sense of your description of the situation and I don't know how your question about a while loop suddenly has anything to do with solve block.
Therefore, I can't say anything about why the assignment to a worksheet variable changes the behavior of your program.
The while loop is used to iteratively solve an equation. When I said a solve block, I meant inside the while loop.