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

Need help making a for loop counter

ptc-5105545
1-Newbie

Need help making a for loop counter

I'm made a double for leep for a Mathcad sheet and I'm trying to add a variable that counts the total number of times the program loops. For example, if I have 2 for loops, both of them from 0 to two, then the total number of times the program lops is four.

Does anyone kow how to do this?

1 ACCEPTED SOLUTION

Accepted Solutions

Leopoldo Vasquez wrote:

I'm made a double for leep for a Mathcad sheet and I'm trying to add a variable that counts the total number of times the program loops. For example, if I have 2 for loops, both of them from 0 to two, then the total number of times the program lops is four.

Does anyone kow how to do this?

Sure.

You could add an additional variable which is set to zero at the beginning of the program and incremented every time the "program loops".

For further help please post your worksheet.

BTW, in the example you gave, I would expect the result nine, if the loops are nested and six, if they are written one after the other, but not four (unless you change the default stepwith one, of course).

View solution in original post

2 REPLIES 2

Leopoldo Vasquez wrote:

I'm made a double for leep for a Mathcad sheet and I'm trying to add a variable that counts the total number of times the program loops. For example, if I have 2 for loops, both of them from 0 to two, then the total number of times the program lops is four.

Does anyone kow how to do this?

Sure.

You could add an additional variable which is set to zero at the beginning of the program and incremented every time the "program loops".

For further help please post your worksheet.

BTW, in the example you gave, I would expect the result nine, if the loops are nested and six, if they are written one after the other, but not four (unless you change the default stepwith one, of course).

Thank you,

That's exactly what I did.

Top Tags