AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A_Break and A_Continue

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Tuncay



Joined: 07 Nov 2006
Posts: 384
Location: Berlin

PostPosted: Mon Dec 17, 2007 11:17 pm    Post subject: A_Break and A_Continue Reply with quote

Its not directly a wish, currently. Just a thought.

New built-in variables A_Break and A_Continue, updated on every continue or break command. They could hold the argument given from that command.
The default, if no argument was specified, the value of last A_Index (that was also requested) could be used.

Example:
Code:
Loop
{
  if a_index = 10
    break
}
msgbox %a_break% ; shows "10"

Loop
{
  if a_index = 10
    break 2 * 4
}
msgbox %a_break% ; shows "8"


But I am not sure what to do, if the Loop is nested and if they should resetted on every new loop or whatever.

edit: ups corrected a small error in code above.
Back to top
View user's profile Send private message Send e-mail
engunneer



Joined: 30 Aug 2005
Posts: 6804
Location: Pacific Northwest, US

PostPosted: Tue Dec 18, 2007 12:32 am    Post subject: Reply with quote

is the reason to try and tell whether it continued or broke last? if they are two variables, you have no way of knowing which one was more recent. I think it's good to come up with ideas like this. What can you see it being used for?
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Titan



Joined: 11 Aug 2004
Posts: 5107
Location: eth0 ::1

PostPosted: Tue Dec 18, 2007 9:05 am    Post subject: Reply with quote

Loops are often used to count things such as the number of files in a folder so a variable like A_Break (or A_LastIndex which I prefer) would be helpful.
_________________

RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
Tuncay



Joined: 07 Nov 2006
Posts: 384
Location: Berlin

PostPosted: Tue Dec 18, 2007 7:45 pm    Post subject: Reply with quote

This could us help to determine why and if a Loop command is exit. I dont think, that it is essential, but it would be used quite frequently often. The last A_Index (A_LastIndex) count is just one often asked or needed example.

What would you await A_Break should hold, if Loop exits without a break? I am also not sure how to tell, if a new iteration started from a continue or not.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group