Visual Basic Fundamentals for Absolute Beginners: (09) For..Next Iterations

Play Visual Basic Fundamentals for Absolute Beginners: (09) For..Next Iterations
Sign in to queue

The Discussion

  • User profile image
    Shadolio

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

  • User profile image
    Duncanma

    @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.)

  • User profile image
    KRISTIYAN NIKOLOV

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

Add Your 2 Cents