Do

Updated: 04/26/2017 by Computer Hope

doA "do" is a loop statement in programming that performs pre-defined tasks while or until a pre-determined condition is met. For example, in the below Perl code the do loop runs until the $count variable has reached the value of 10.

my $count = 0;
do {
     print "$count\n";
     $count++;
} until ($count >= 10);

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

For, Loop, Programming terms, While