Article Preview
Buy Now
COLUMN
Getting Loopy
Using the right loop
Issue: 4.2 (November/December 2005)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 15,294
Starting Page Number: 30
Article Number: 4213
Resource File(s):
4213.zip Updated: 2013-03-11 19:07:59
Related Link(s): None
Excerpt of article text...
Loops are one of the most important concepts in computer programming -- in a sense, that's all computers do. They loop, or repeat a series of actions, such as waiting for a user to tell it to do something. Loops are so basic, however, that they are rarely explained. Many beginners or self-taught programmers just absorb looping from looking at other code and just use one kind of loop and tend to forget that there are multiple kinds. Rarely do beginners take the time to figure out what kind of loop is best for the situation at hand. However, there are different loop types for a reason, and in today's lesson we're going to explore them.
For-Next Loop
The most common loop is the familiar
for-next
loop, which increments a counter each time through the loop. This is ideal for when you know how many times you need to go through the loop. For instance, for processing a number of files or counting through an array of data. I'm sure you're all familiar with this common loop so I won't spend a great deal of time on it, but there are some rarely used aspects offor-next
that some beginners may not know about and more experienced programmers may have forgotten.
...End of Excerpt. Please purchase the magazine to read the full article.