I need to convert C code below to an activity diagram using PlantUML.
What is a good solution to implement the "continue" statement from the code below ?
void function_1(){
int a = 0;
int b =0;
for (int i; i < 8; i++)
{
if (i < 2)
{
continue;
}
if (i > 4)
{
a = 1;
}
else
{
b = 2;
}
}
}
I do not know C but it seems to me that one way of representing your logic in PlantUML would be as follows:
start
while (i < 8 ?)
if (i > 4 ?) then (yes)
:a = 1;
else (no)
if (i >= 2 ?) then (yes)
:b = 2;
else (no)
endif
endif
endwhile (no)
:Carry out the next task;
end
The "Carry out the next task" task is a placeholder. It should be replaced with whatever your application is supposed to do next.
Which yields the following diagramme: