我需要使用 PlantUML 将下面的 C 代码转换为事件图。
从下面的代码中实现“继续”语句的好解决方案是什么?
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;
}
}
}
最佳答案
我不懂 C,但在我看来,在 PlantUML 中表示逻辑的一种方法如下:
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
“执行下一个任务”任务是一个占位符。它应该替换为您的应用程序下一步应该执行的操作。
关于c - 如何在 PlantUML 事件图中使用 C 中的 "continue"语句表示循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58637166/