Visual Basic Fundamentals for Absolute Beginners: (09) For..Next Iterations
Description
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.
Full course outline:
 Mod 01: Series Introduction
 Mod 02: Installing Visual Studio Express 2013 for Windows Desktop
 Mod 03: Creating Your First Visual Basic Program
 Mod 04: Dissecting the First Visual Basic Program You Created
 Mod 05: Quick Overview of the Visual Basic Express Edition IDE
 Mod 06: Declaring Variables and Assigning Values
 Mod 07: Branching with the If..Then..Else Decision Statement
 Mod 08: Operators, Expressions and Statements
 Mod 09: For..Next Iterations
 Mod 10: Creating Arrays of Values
 Mod 11: Creating and Calling Simple Overloaded Helper Methods
 Mod 12: While Iterations and Reading Data from a Text File
 Mod 13: Working with Strings
 Mod 14: Working with Dates
 Mod 15: Understanding and Creating Classes
 Mod 16: More about Classes and Methods
 Mod 17: Working with Classes and Inheritances in the .NET Framework Class Library
 Mod 18: Understanding Namespaces and Adding References to Assemblies
 Mod 19: Understanding Modules, Scope and Utilizing Accessibility Modifiers
 Mod 20: Enumerations and the switch Decision Statement
 Mod 21: Gracefully Handling Exceptions
 Mod 22: Working with Collections
 Mod 23: Filtering and Managing Data in Collections using LINQ
 Mod 24: Understanding Event Driven Programming
 Mod 25: Getting Familiar with the My Namespace
 Mod 26: Where To Go From Here
Download
Right click or Alt+Enter to download this episode
 MP3 (10.7 MB)
 Low Quality MP4 (16.4 MB)
 High Quality MP4 (64.9 MB)
 Mid Quality MP4 (41.5 MB)
Download captions
The Discussion

What's the difference between the use of the For..Next and Loop..Until statements?

@Shadolio: For Next is traditionally used when you want to go through a loop a specific number of times. You could accomplish the same thing in a Loop, but you'd have to declare the index variable and you'd have to increment it yourself. It does allow you some more flexibility (you could increment by 2 if a certain condition was met for example), but it also opens the door to an infinite loop if you forget to increment the counter or write your logic incorrectly. If you have a fixed number of loop iterations in mind, I'd use a For ... Next, if you want to loop until you find something or for a variable amount of time, then a Do Until ... Loop may be a better choice. Just make sure you always have a way out (if you hit the end of the file, or have been looping more than x times without hitting your expected condition, etc.)

hello seems this note with tab tab is enable by configuration i dont have it

Hi! I was just wondering, in the second example where you write this code:
For x = 10 To 5 Step 1
Console.WriteLine(x)
Next
How come x doesnt have to be declared first? Is x not a variable here? Sorry, just a little confused!