For . . . Next Iterations - 08
- Posted: Nov 21, 2011 at 9:25 AM
- 25,074 Views
- 3 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Iterations allow our applications to loop through a block of code until a condition is satisfied. We'll cover several different types of iteration statements throughout this series, but we'll start with the for iteration statement. I'll demonstrate how to utilize "code snippets" to help remind you of the syntax for this complex statement, and will demonstrate debugging in action as we watch the values of our loops displayed in the Visual Studio IDE in several ways.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
First, I didn't understand 'for statement' covers which area.
Moreover, In the first example 'exit for' is located inside if statement, how is the operation queue?
Does it mean "never exit from 'for statement' unless 'if statement' is validated"?
Should we follow statements line by line or when a statement begins it ends with an end point declaration?
Sorry, I think I had found the answer about 'exit for' by making a simple test.
It simply disrupts for statement and code continues from the line after 'next', and 'exit for' isn't also a must for such a statement, boundaries are defined with for statement anyway.
@halit ates:The "Exit For" statement jumps the code out of the "For Next" statement. Say that you need to evaluate whether a condition is true for thousands of values (For index = 1 to 1000000) . If the value you are looking for is the first one that is evaluated and is true then without the "Exit For" statement your code would check the next 999999 values even though you have already found the value that you are looking for. So basically the "Exit For" simply speeds up the execution of your software by "jumping over" all of the values that you do not need to evaluate. In older versions of basic you would have used a "GoTo" statement to do the same thing at the expense of adding one more line of code.
Remove this comment
Remove this thread
close