o0o0ohanhanngao0o0o Posted July 19, 2008 Share Posted July 19, 2008 hi everybodycan u show me again this word, STEP i don't understant that wordmay u show me abvious , please thanks so much Link to comment Share on other sites More sharing options...
Paulie Posted July 19, 2008 Share Posted July 19, 2008 hi everybody can u show me again this word, STEP i don't understant that word may u show me abvious , please thanks so muchit allows you to choose the increment of the variable in the For...Next loop EX: For $i = 5 to 0 step -1 Msgbox(0,"",$i) Next This code will count from 5 down to 0. If we hadn't had the "step -1" in there, it would be trying to count up by 1(default) to get to zero which would obviously never happen. Link to comment Share on other sites More sharing options...
Linux Posted July 19, 2008 Share Posted July 19, 2008 hi everybodycan u show me again this word, STEP i don't understant that wordmay u show me abvious , please thanks so muchAre you asking for an example?For $i = 1 to 100 Step 10 Consolewrite(@crlf & $i)Next Consolewrite(@crlf & "---------------") For $i = 100 to 1 Step -10 Consolewrite(@crlf & $i) Next You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!" Link to comment Share on other sites More sharing options...
o0o0ohanhanngao0o0o Posted July 19, 2008 Author Share Posted July 19, 2008 it allows you to choose the increment of the variable in the For...Next loop EX: For $i = 5 to 0 step -1 Msgbox(0,"",$i) Next This code will count from 5 down to 0. If we hadn't had the "step -1" in there, it would be trying to count up by 1(default) to get to zero which would obviously never happen. if i write for $n = 5 to 0 MSgbox(0,"",$n) Next [code=auto:0] what's happen , i can see the number from 0 to 5 Why ? Link to comment Share on other sites More sharing options...
o0o0ohanhanngao0o0o Posted July 19, 2008 Author Share Posted July 19, 2008 (edited) it allows you to choose the increment of the variable in the For...Next loop EX: For $i = 5 to 0 step -1 Msgbox(0,"",$i) Next This code will count from 5 down to 0. If we hadn't had the "step -1" in there, it would be trying to count up by 1(default) to get to zero which would obviously never happen. if i write for $n = 5 to 0 MSgbox(0,"",$n) Next what's happen , i can not see the number from 0 to 5 Why ? Edited July 19, 2008 by o0o0ohanhanngao0o0o Link to comment Share on other sites More sharing options...
Paulie Posted July 19, 2008 Share Posted July 19, 2008 (edited) if i write for $n = 5 to 0 MSgbox(0,"",$n) Next what's happen , i can not see the number from 0 to 5 Why ?Because unless a "step" is defined, it starts at the first number (in this case, 5) and counts up until it gets to the second number (in this case, 0) obviously, you can't count up to zero from 5, so the script fails. Edited July 19, 2008 by Paulie Link to comment Share on other sites More sharing options...
o0o0ohanhanngao0o0o Posted July 19, 2008 Author Share Posted July 19, 2008 it allows you to choose the increment of the variable in the For...Next loop EX: For $i = 5 to 0 step -1 Msgbox(0,"",$i) Next This code will count from 5 down to 0. If we hadn't had the "step -1" in there, it would be trying to count up by 1(default) to get to zero which would obviously never happen. why do u use -1 at step but why dont u use 2 or 3 or ........ Link to comment Share on other sites More sharing options...
o0o0ohanhanngao0o0o Posted July 19, 2008 Author Share Posted July 19, 2008 help me that question please that is last question if i understand , please Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 19, 2008 Moderators Share Posted July 19, 2008 Step moves forward or backward the number you provide for it.Step with a positive number after: Step 1 or Step 2 etc... Will move forward 1 or 2 in a For Next loop.Step with a negative number after: Step -1 or Step -2 etc... Will move backward 1 or 2 in the For Next loop.So if I want skip 2 at a time forward:For $i = 1 To 10 Step 2 MsgBox(64, "Info", $i) NextoÝ÷ ØÈÁ©í¶$µ«bæÚrLÛºÚ"µÍÜ ÌÍÚHHLÈHÝHÙÐÞ ][ÝÒ[É][ÝË ÌÍÚJB^Note the larger integer first in the For next 10 Then 1, Since it's larger first, I use the negative approach demonstrated. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
o0o0ohanhanngao0o0o Posted July 19, 2008 Author Share Posted July 19, 2008 thanks so much thank you very much i got it 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