Updated: 04/26/2017 by Computer Hope

While may refer to any of the following:

while loop1. A while loop or repeat loop is a loop statement in programming that performs pre-defined tasks while in the process of doing something else. For example, in Perl with code similar to the below, a while loop opens the file "file.txt" and while going through each of the lines in the file, printing them if they contain any letters.

open (INPUT, "<file.txt");
while (<INPUT>) {
     if ($_ =~ /[a-zA-Z]/) {
          print "$_";
close (INPUT);

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

2. While is also a Linux command, see the while command page for further information about this command.

Do, Loop, Programming terms