Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Language Overview > eScript Statements >
goto Statement
The goto statement redirects execution to a specific point in a function.
Syntax
goto label;
Placeholder Description label A marker, followed by a colon, for a line of code at which execution should continueReturns
Not applicable
Usage
You can jump to any location within a function by using the goto statement. To do so, you must create a label—an identifier followed by a colon—at the point at which execution should continue. As a rule, goto statements should be used sparingly because they make it difficult to track program flow.
Example
The following example uses a label to loop continuously until a number greater than 0 is entered:
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 + "." );
}
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |