Siebel eScript Language Reference > Statements Reference > Guidelines for Using Siebel eScript >

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;
}

Table 27 describes the arguments for the While statement.

Table 27. 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);
}

Siebel eScript Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.