Use Continue in Repeated Code

Get help with using AutoHotkey and its commands and hotkeys
1100++
Posts: 78
Joined: 10 Feb 2018, 19:05

Use Continue in Repeated Code

23 Sep 2018, 15:25

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?
User avatar
AlphaBravo
Posts: 513
Joined: 29 Sep 2013, 22:59

Re: Use Continue in Repeated Code

23 Sep 2018, 19:54

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
}

Return to “Ask For Help”

Who is online

Users browsing this forum: Dsalomon, Falleau and 36 guests