if (in ruleflow)
The
if keyword executes one statement
block or another, depending on a Boolean expression value.
Purpose
This statement is a conditional ruleflow statement that executes one statement block or another depending on the return value of a Boolean expression.
Context
In a ruleflow body
Syntax
if (test)
{ruleflowStatement}
[else {ruleflowStatement}]
Description
The test can be any valid test,
as in the Java™ programming language.
If the Boolean expression returns true, the ruleflow
statement block that follows the if is executed.
If the expression returns false, the ruleflow statement
block corresponding to the else part is executed.
The 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;
}
};