Summary
A ruleflow conditional statement for executing one statement block or another according to a Boolean expression value. This keyword is used in a ruleflow body.
Syntax
if (test)
{ruleflowStatement}
[else {ruleflowStatement}]
Description
The if statement is a conditional ruleflow statement. The test may be any legal test as in the programming language Java. If the Boolean expression returns true, the ruleflow statement block following the if is executed. If the expression returns false, the ruleflow statement block corresponding to the else part is executed. Having an else part is not mandatory.
Example
flowtask main
{
body =
{
while(!ending)
{
if (turn == Constants.Player1) ChooseMovePlayer1;
else ChooseMovePlayer2;
CheckMove;
if (ending) break;
UpdateDistance;
ExpandObjects;
DetectConnect4;
if (ending) break;
DetectGridFull;
if (ending) break;
ChangeTurn;
}
EndOfGame;
}
};
See Also
body (in Flow Task), flowtask