@startuml start if (是否是第一次使用) then (是) :显示欢迎界面; :跳转到登录界面; else (否) :跳转到登录界面; endif stop @enduml
if (...) is (...) then
1 2 3 4 5 6 7 8 9
@startuml start if (颜色?) is (<color:red>red) then :red; else :blue; endif stop @enduml
if (...) equals (...) then
1 2 3 4 5 6 7 8 9
@startuml start if (记数?) equals (5) then :步骤一; else :步骤二; endif stop @enduml
终止一个行为:
1 2 3 4 5 6 7
@startuml if (条件?) then :错误; stop endif #palegreen:行为; @enduml
停止到某个行为上,使用kill 或 detach关键字:
1 2 3 4 5 6 7
@startuml if (条件?) then #pink:错误; kill endif #palegreen:行为; @enduml
横向展示纵向展示
横向展示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
@startuml start if (condition A) then (yes) :Text 1; elseif (condition B) then (yes) :Text 2; stop (no) elseif (condition C) then (yes) :Text 3; (no) elseif (condition D) then (yes) :Text 4; else (nothing) :Text else; endif stop @enduml
纵向展示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
@startuml !pragma useVerticalIf on start if (condition A) then (yes) :Text 1; elseif (condition B) then (yes) :Text 2; stop elseif (condition C) then (yes) :Text 3; elseif (condition D) then (yes) :Text 4; else (nothing) :Text else; endif stop @enduml
switch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
@startuml start switch (测试?) case ( 条件 A ) :Text 1; case ( 条件 B ) :Text 2; case ( 条件 C ) :Text 3; case ( 条件 D ) :Text 4; case ( 条件 E ) :Text 5; endswitch stop @enduml
重复循环
1 2 3 4 5 6 7 8
@startuml start repeat :读取数据; :生成图片; repeat while (更多数据?) stop @enduml