Print progress every 10 iterations for 1000 iterations

13,096

You likely want to use a modulus operator

If you base check your iterator in the loop and mod it against 10 then you can have it perform some action every time the iterator is evenly divisible by 10.

Share:
13,096
Admin
Author by

Admin

Updated on June 17, 2022

Comments

  • Admin
    Admin almost 2 years

    The Title says it all. I tried looking for this but to no avail.

    Basically, I am running a For Loop with 1000 iterations, and I would like to write a function that shows/prints the progression of the simulation every 10 iterations.