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

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;

Table 21 describes the argument for the Goto statement.

Table 21. 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 + "." );
}

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