Goto Statement

The Goto statement causes Siebel eScript to go to a specific point in a function. You can write code that directs Siebel eScript to go to any location in a function. It is recommended that you use a Goto statement only rarely because it makes it difficult to follow the code flow.

Format

goto label;

The following table describes the argument for the Goto statement.

Argument Description

label

Indicates the code line where Siebel eScript must resume running the code. You must place a label argument at the point where Siebel eScript must resume running the code.

Example

The following example uses a label argument to loop continuously until the number is greater than 0:

function clickme_Click ()
{
restart:
   var number = 10;
   if (number <= 0 )
      goto restart;
   var factorial = 1;
   for ( var x = number; x >= 2; x-- )
      factorial = (factorial * x);
   TheApplication().RaiseErrorText( "The factorial of " + 
      number + " is " + factorial + "." );
}