JohnOne Posted January 28, 2015 Share Posted January 28, 2015 When you say "the code belongs together", what exactly do you mean? Like in the same physical location in you literal script? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted January 28, 2015 Author Share Posted January 28, 2015 (edited) Yes it's part of the same module as the lines of script which surround the sequence of loops. The whole function has one purpose - to set up conditions suitable to continue on to the next phase (in another part of the script). Since all the data is readily accessible in the local scope, it seems an unecessary inconvenience to port the arguments elsewhere. I'm not saying this approach is necessarily better, but I think it ought to be a valid option in some situations. Edited January 28, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Malkey Posted January 28, 2015 Share Posted January 28, 2015 (edited) I would use one If-Then command with Or's for all the same reasons as Bowmore stated in post #17. Plus, there is no unnecessary confusing code - like a loop!. Local $bCondition1 = True, $bCondition2 = True, $bCondition3 = True Local $bCondition4 = True, $bCondition5 = false If _ $bCondition1 And _ ; test 1 $bCondition2 And _ ; test 2 ($bCondition3 And $bCondition4) And _ ; test 3 $bCondition5 _ ; test 4 Then MsgBox(0, "", "Passed", 3) Edit: Changed all "Or" to "And" Edited January 28, 2015 by Malkey Link to comment Share on other sites More sharing options...
jaberwacky Posted January 28, 2015 Share Posted January 28, 2015 It looks to me that if $bCondition = True, then test 2 will never execute. If $bCondition is False, then both tests will execute. In this case test 2 can be done away with no difference in how the code works. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Malkey Posted January 28, 2015 Share Posted January 28, 2015 @jaberwacky You are correct, my mistake. I have edited my post #23 Link to comment Share on other sites More sharing options...
jaberwacky Posted January 28, 2015 Share Posted January 28, 2015 (edited) Oh, I haven't been reading anybody's code. I'm just commenting on the 1st post. Glad I could help though. Edited January 28, 2015 by jaberwacky TheSaint 1 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
JohnOne Posted January 28, 2015 Share Posted January 28, 2015 Yes it's part of the same module as the lines of script which surround the sequence of loops. The whole function has one purpose - to set up conditions suitable to continue on to the next phase (in another part of the script). Since all the data is readily accessible in the local scope, it seems an unecessary inconvenience to port the arguments elsewhere. I'm not saying this approach is necessarily better, but I think it ought to be a valid option in some situations. It's valid without a doubt, Just remains to be seen whether it's purely an aesthetic preference in coding style or whether the are any benefits with regards efficiency. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted January 28, 2015 Author Share Posted January 28, 2015 (edited) The >inner loops can't be removed, so Malkey's suggestion is not valid. The first post is a simplification of the concept. I have thought a little deeper about this and have come to the following conclusion (wherein lies the advantage of using Do...Until): This is intended use (although perhaps not anticipated), Do... run the loop first ... Until (condition is met) - Do loops will always run once regardless of condition. Others (While and For loops) test the condition first - These loops may sometimes never run. So I conclude this to be within the realms of good practice. @JohnOne - I doubt there would be any noticable speed gain (certainly not significant). Edited January 28, 2015 by czardas TheSaint 1 operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now