Consider:
if (player1.isAvailable)
{
if (player1.position == "Goalkeeper")
{
System.Console.WriteLine("Goalkeeper is available.");
}
}The second decision exists only inside the true path of the first decision.
An activity diagram should preserve that relationship.
The first decision can be stated as:
Is the player available?Its true path leads toward the inner decision.
Its false path bypasses the inner decision.
The inner decision can be stated as:
Is the player's position "Goalkeeper"?Conceptually:
Start
↓
Is the player available?
◇
/ \
[true] [false]
| |
v |
Is the player a goalkeeper?
◇ |
/ \ |
[true] [false]
| |
v |
Display |
message |
\ /
\ /
Continue
↓
EndThe exact layout can vary, but the meaning should not.
If:
player1.isAvailable = falsethe program does not evaluate the goalkeeper condition.
The activity diagram should show that the false path skips the inner decision entirely.
This is misleading:
Start
/ \
available? goalkeeper?That suggests both questions can be reached independently.
The source does not behave that way.
The second decision is conditional on the first path.
For an else if chain, the next decision is reached from the false path of the earlier decision.
For this nested example, the next decision is reached from the true path.
That difference is the central visual feature.
A readable activity diagram can use:
Is the player available?and:
Is the player a goalkeeper?The diagram should communicate the behavioral question rather than reproduce every C# symbol.
Use true/false labels so the reader can tell which path belongs to which decision.
With multiple decision nodes, branch labels must be interpreted relative to the decision they leave.
outer true
inner true
message runsouter true
inner false
message skippedouter false
inner decision not reached
message skippedIf the diagram supports all three traces correctly, it represents the nested behavior.
If execution continues after the nested structure, the diagram should show the relevant paths reconnecting to that shared continuation.
A nested decision in C# becomes a decision node placed inside the appropriate branch of another decision in the activity diagram.