The Wildcats check a player's role only when the player is available. Nesting means the inner decision is reached on one outer route.
This excerpt is inside an existing method. The Boolean inputs isAvailable and isGoalkeeper already exist; instruction stores the selected text.
If the underlying C# feature is unfamiliar, use the lesson below while reading this example.
string instruction;
if (isAvailable)
{
if (isGoalkeeper)
{
instruction = "Guard the goal";
}
else
{
instruction = "Practice passing";
}
}
else
{
instruction = "Wait";
}Check whether the player is available
If unavailable, select Wait
If available, check whether the player is a goalkeeper
For an available goalkeeper, select Guard the goal
For another available player, select Practice passing
Continue after the selected instructionUse these words to follow one execution before drawing it. Keep the same order and the same alternatives as the source; simplify the wording without adding work that the code does not perform.
Player available?.true route place a second diamond labeled Goalkeeper?. On its false route place Set instruction to Wait.Set instruction to Guard the goal and false to Set instruction to Practice passing. Keep each arrow label next to its own decision.Compare this reference with the diagram you built in Violet. Layout may differ; the source meaning, labels, and relevant connections should agree.
An unavailable goalkeeper selects Wait after only the first check. An available non-goalkeeper reaches both checks and selects Practice passing.