| Reference > Rule Languages > ILOG Rule Language > IRL Keywords > goto |
goto |
PREVIOUS NEXT |
A ruleflow statement for jumping to another ruleflow statement. This keyword is used in the flowtask body.
goto label;
The goto statement is a ruleflow statement that gives the option of jumping to another statement in the ruleflow. The target statement must be labeled, and this label is the one referenced in the goto statement.
A goto statement can be used in a fork or while statement if the following rules are respected:
fork statement if it does not jump to a statement that does not belong to one of the fork blocks.
while statement if it does not jump to a statement outside the while loop.
flowtask main
{
body =
{
start: if (turn == Constants.Player1) ChooseMovePlayer1;
else ChooseMovePlayer2;
CheckMove;
if (ending) goto end;
UpdateDistance;
ExpandObjects;
DetectConnect4;
if (ending) goto end;
DetectGridFull;
if (ending) goto end;
ChangeTurn;
goto start;
end: EndOfGame;
}
};
The ruleflow consists of a loop implemented with the goto statement goto start, which jumps to the beginning of the flow. The loop can be interrupted under some conditions, and this interruption is implemented with goto statements goto end; start and end are the labels of the first and last ruleflow statements, respectively.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |