Siebel eScript Language Reference > Siebel eScript Language Overview > Siebel eScript Statements >

while Statement


The while statement executes a particular section of code repeatedly until an expression evaluates to false.

Syntax

while (condition)
{
     statement_block;
}

Placeholder
Description

condition

The condition whose falsehood is used to determine when to stop executing the loop

statement_block

One or more statements to be executed while condition is true

Usage

The condition must be enclosed in parentheses. If expression is true, the Siebel eScript interpreter executes the statement_block following it. Then the interpreter tests the expression again. A while loop repeats until condition evaluates to false, and the program continues after the code associated with the while statement.

Example

The following fragment illustrates a while statement with two lines of code in a statement block:

while(ThereAreUncalledNamesOnTheList() != false)
{
   var name = GetNameFromTheList();
   SendEmail(name);
}

Siebel eScript Language Reference