Jump to content

Do something every 1k loops ?


Go to solution Solved by fraizor,

Recommended Posts

Hello

I have a huge loop (around 100k)

I was wondering if there is a way to do a function every 1k loops

i can hardcode the number in IF condition but this looks silly ...

 

any ideas ?

 

AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !

Link to comment
Share on other sites

Actually yes , but my brain crashed :D

 

Like i can imagine  how mod() could help if the loop is fixed to 100k, so i could easily do mod($i, 10000) 

However i cant understand how this would work for dynamic loop size ....

 

One more thing , regarding mod() is  it a heavy function ? wont this waste time and CPU power to calculate mopd in every single loop ? 
 

AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !

Link to comment
Share on other sites

  • Developers

Not sure why you are at ll worried about cpu cycles when using an interpreter scripting language! ;)

As to the Mod() function, it is simple so I am sure you will be able how to code an if that will be true each 1000 cycles. Just kick your brain in gear at try it as that takes less time than tying your question here. 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
10 minutes ago, fraizor said:

am i right ?

Did you try and did it work? 🙄

Spoiler

(it won't do what you initially asked though as 1k <> 10000)

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

5 minutes ago, Jos said:

Did you try and did it work? 🙄

  Reveal hidden contents

(it won't do what you initially asked though as 1k <> 10000)

 

Yes thank you guys , all

AutoFox, A Modern, Simple, No dependency, Noob friendly yet powerful Firefox UDF !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...