Let's start with the For loop. Let me give an example so I could explain it to you.
For x = 1 to 10
Print "Hello"
Next x
In this example, x will acquire values from 1 to 10 meaning, it will repeat the statement Print "Hello" 10 times. It will output 10 Hellos on your screen. Next x serves as a container which encloses the statements that the For loop will repeat. So as you can see, it will simply count from 1 to 10 and when finished, it will move on to the statement after Next. While Wend and Do Until are somewhat similar. Let me give you an example for each.
x = 1
While x = 1
If condition = met then x = 2
Wend
x = 1
Do
If condition = met then x = 2
Until x 1
It looks confusing if you compare the two but you'll get it as you go along. While Wend loops will repeat the statements until the condition (x = 1) becomes false. From the example, the While Wend loop will loop over and over while x is equal to 1. If a condition is met (depending on the logic of the program you're trying to develop) within the loop and you change the value of the variable, the loop will end.
On the other hand, in the Do Until example, the loop will repeat until x becomes any other number aside from 1. So if the value of x does not change, it will continue to repeat. If the condition (x 1 , x is not equal to 1) becomes true, the Do Until loop ends.
So depending on the situation and the logic of your program, choose properly between the 3 loops. For loops will repeat a set number of times, While Wend loops will repeat itself while the condition is true and Do Until loops will repeat itself until the condition becomes true.
These are just the basic applications of these loops. There are much more advanced uses for these loops. However, in order to utilize the loops more effectively, you must understand the basics first. Knowing how to use them can save you time and will make your program easier to code and understand. You'll probably have your own unique way of using these loops as you learn and continue to practice programming.
Published by Aaron Tadeo
Writing has become one of my hobbies and I really love the feeling when I share my experiences and knowledge as a freelance writer. I'm currently working as a customer service rep. I love computers and been... View profile
- Information System Development Technique & Software Development Life CycleAn organization can utilize the modeling technique in mapping out and planning how to implement the software development life cycle in order to execute their software strategy
- Agile Methodology: A Software Development Process FrameworkAgile methodology is a software development process framework that adopts the iterative approach, open collaboration, and process adaptability throughout the life-cycle of the project.
- Flex 2: Software Development Kit for Rich Internet Applications Aimed for Flash Pl...Flex 2 is a Rich Internet Application framework for building responsive Graphical User Interface (GUI) applications deployed on the Adobe Flash player plugin which is available in all modern A-grade browsers.
- Forex Trading Software as a Lucrative Software Development IdeaIf you are considering software development as a business venture, you may want to consider the option of forex trading software as forex trading has become a more lucrative online venture.
Tips for Learning Computer Programming on Your OwnLearn basic concepts and computer programming techniques to give you the ability to manage your own website or desktop application.
- Computer Programming - Then and Now
- Computer Programming is Easy and Fun for Kids
- Computer Programming
- Computer Programming Languages
- Myths Abound Regarding Careers in Computer Programming Part II
- Myths Abound Regarding Careers in Computer Programming Part I
- Computer Programming: Is it for Me?




