For

A loop statement in programming that performs predefined tasks while or until a predetermined condition is met. Below is an example of a for loop in Perl that prints "Computer Hope" five times.

for ($i = 1; $i < 6; $i++) {
print "Computer Hope\n";
}

In the above example, the for loop first sets the variable $i to a value of 1; each time it executes, the $i variable is increased by 1, while it's less than 6 "Computer Hope" is printed to the screen.

Tip: Like any loop when creating a for loop make sure it condition will always be met to help prevent an endless loop.

Also see: Do, Foreach, Loop, Programming definitions, While