cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. 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?

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ptc-5105545)

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
Werner_E
25-Diamond I
(To:ptc-5105545)

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.

Announcements

Top Tags