16.3 While Loops

16.3.1 Synopsis

while (condition)
  statement;

16.3.2 Description

statement is executed until condition is true.

You can also execute more than one statement inside the loop: simply enclose them between braces:

while (condition) {
  statement1;
  statement2;
}

16.3.3 Example

i=1;
while (i < 100) {
  print (i);
  i = i * 2;
}

Cows' output:

1
2
4
8
16
32
64

This manual can be downloaded from http://www.g-cows.org/.