AutoHotkey Community

It is currently May 27th, 2012, 12:56 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: September 11th, 2011, 3:09 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
The problem is, that anything made simpler by the addition of a for loop is made more complicated by adding your function. Using a function for it is pointless, unless the code is a full blown project of yours.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2011, 3:32 am 
Offline
User avatar

Joined: June 22nd, 2011, 4:02 pm
Posts: 171
nimda wrote:
Using a function for it is pointless, unless the code is a full blown project of yours.


With all due respect I completely disagree. The same claim could be made about any function posted in these forums.

The function posted is completely general and doesn't take any special skill or knowledge to use.

Unless you think you can get Lexikos to change the language I think using a function is the best solution.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2011, 3:42 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
rbrtryn wrote:
With all due respect I completely disagree. The same claim could be made about any function posted in these forums.
most functions in these forums fulfill some not-so-easy task, to the point where not using the function would be silly. In those cases, when helping someone you must take the effort to tell them how and where to get the library. Yours however, does not save enough time to justify that.

Quote:
The function posted is completely general and doesn't take any special skill or knowledge to use.
OK...?

Quote:
Unless you think you can get Lexikos to change the language I think using a function is the best solution.
Unless Lexikos decides that in this particular case, consistency with other languages is better, using a While loop with an init variable before it and increments within the while statement such as
Code:
i := -10
While ++i < 11
is the best solution

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2011, 3:50 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
I benchmarked a number of different methods, iterating from 10 to 100 with a step of 10. The results were:
  • Loop, A_Index*10: 1.00
  • Init, while, increment: 1.20
  • Loop..until: 1.35
  • range: 4.85
  • nrange: 8.30
  • InRange: 13.00
(Values are relative, for comparison only.)

Using Loop and A_Index is typically the simplest and most efficient method. Anyone that understands basic programming and mathematics should be able to use it.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group