Jerry123 Posted August 12, 2010 Share Posted August 12, 2010 What does the FOR STATEMENT actually do? for = to // step 1end // for Link to comment Share on other sites More sharing options...
Deji Posted August 12, 2010 Share Posted August 12, 2010 A for loop runs over and over again, storing the times it has run in the variable until it gets to a certain number. for [email protected] = 0 to 10 wait 1000end In the example, there will be a 10 second wait... The [email protected] starts off with an initial value of 0 and then (by the end of the loop) has a value of 10. You can also do the operation in reverse... for [email protected] = 10 downto 0 wait 1000end Which means the variable has an initial value of 10 and counts down to 0. This kind of loop is good for working with arrays. Link to comment Share on other sites More sharing options...
Jerry123 Posted August 12, 2010 Author Share Posted August 12, 2010 A for loop runs over and over again, storing the times it has run in the variable until it gets to a certain number. for [email protected] = 0 to 10 wait 1000end In the example, there will be a 10 second wait... The [email protected] starts off with an initial value of 0 and then (by the end of the loop) has a value of 10. You can also do the operation in reverse... for [email protected] = 10 downto 0 wait 1000end Which means the variable has an initial value of 10 and counts down to 0. This kind of loop is good for working with arrays. Thanks you were really helpful! 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