While Statement

The While statement runs a section of code repeatedly until an expression evaluates to false. It does the following:

  1. Examines the expression.

  2. If the expression is true, then it does the following:

    1. Runs the code in the statement block that occurs after the condition argument.

    2. Repeats step 1.

  3. If the expression is false, then Siebel eScript runs the code that occurs immediately after the statement block.

A while loop repeats until the value in the condition argument is false.

Format

while (condition)
{
     statement_block;
}

The following table describes the arguments for the While statement.

Argument Description

condition

Includes a value that determines when to stop running the loop. You must enclose this argument in parentheses.

statement_block

One or more statements that Siebel eScript runs while the condition argument is true.

Example

The following example includes a While statement that includes two lines of code in a statement block:

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