How to continue loop in script with if else statement? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Thadeus
Posts: 7
Joined: 10 Dec 2022, 07:30

How to continue loop in script with if else statement?

Post by Thadeus » 26 Jan 2023, 13:31

Hello everyone.

I have a question for you. I've made a script that sends specific Excel data into one application. The script works flawless but I bump into a small problem.

I've made the script in loop to add all the data one by one into the application. In the middle of running script I've added if else to stop next part of the script if IF is true.

And it works, sort of. I've added if true {Return}, else make the rest of the script.

The problems is with this, that after the condition being true, the script just stops (Return). And I want to start next iteration of the loop from very beginning.

Hope You understand what I have in mind.

Thank you all in advance, cheers!

RussF
Posts: 1264
Joined: 05 Aug 2021, 06:36

Re: How to continue loop in script with if else statement?  Topic is solved

Post by RussF » 26 Jan 2023, 14:32

Instead of Return, use Break or Continue, depending on your needs.

Break takes you out of the current loop completely, and Continue skips the rest of the code in the loop, and goes back to the beginning of the current loop for the next iteration.

Russ

Thadeus
Posts: 7
Joined: 10 Dec 2022, 07:30

Re: How to continue loop in script with if else statement?

Post by Thadeus » 26 Jan 2023, 14:56

I knew about Return and Break but not about Continue. This sounds like it should fit in nicely. Thank you very much, have to give it a try tomorrow. :)

Post Reply

Return to “Ask for Help (v1)”