Updated: 04/26/2017 by Computer Hope

While may refer to any of the following:

while loop

1. 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 the code below using Perl, a while loop opens the file "file.txt." While going through each of the lines in the file, the code prints them if they contain any letters.

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

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