Geas MUD, enter the Aventure!
Geas Home | Play the Game

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2.11.2 The while statement

The while statement is pretty straight-forward, you can guess from the very name what it does. The statement will perform another statement over and over until a given while expression returns false. The syntax is simple:

 
while (<test expression>)

Note carefully that the test expression is checked first of all, before running the statement the first time. If it evaluates as false the first time, the body is never executed.

 
a = 0;
while (a != 4)
{
    a += 5;
    a /= 2;
}



This document was generated by Ronny Wikh on July, 8 2003 using texi2html