The while statement repeats a block of statements while a condition is true. The syntax is as follows:

while <condition> {<statements>}

The following script has no pattern matching. The variable x is printed and incremented by one until it is no longer less than five.

ASL Script (while_do.asl):
x=0;
START
do {
 while x < 5
 {
  print(x);
  x=x+1;
 }
 stop();
}
Input:
none
Output:
$ sm_adapter while_do.asl
0
1
2
3
4
$