Page 1 of 1

Use Continue in Repeated Code

Posted: 23 Sep 2018, 15:25
by 1100++
I have a snippet of code that appears in several places inside a loop I'm writing, and this snippet uses Continue to terminate the current loop iteration and start a new one. I tried writing the snippet as a function, but the script gave a warning saying that Continue had to be used inside a loop. Is there any way I can accomplish this programming feat?

Re: Use Continue in Repeated Code

Posted: 23 Sep 2018, 16:30
by swagfag
post code

Re: Use Continue in Repeated Code

Posted: 23 Sep 2018, 19:54
by AlphaBravo
Please don't start a new post for the same question
https://autohotkey.com/boards/viewtopic.php?f=5&t=56188

Maybe you're looking for something like :

Code: Select all

loop 10
{
	if namedLoop(A_Index)
		continue
	MsgBox % A_Index
}
	
namedLoop(i){
	if (i < 5)
		return 1
}