Connect arrows from conditional block to action block of another condition

0 votes
asked Mar 20, 2025 in Question / help by Alessio

Hello,

in activity diagrams, is it possible to connect arrows from conditional blocks to action blocks that belong to other conditional blocks? For example 

I'd like to connect the "yes" arrow to the SLEEP block above, avoiding to create another identical one.

Thanks in advance for the help. 

commented Mar 23, 2025 by The-Lu (88,340 points)

Hi A.,

  • Could you send us your source code?
    or a minimal not working example...

Regards,
Th.

commented Mar 24, 2025 by Alessio
Hello,

apologize for that, i copied an image in the initial message but just checked it was not inserted.

Below a simple code for the case i mean :

start
if (condition 1) then (yes)
   :ACTION A;
   kill
 else (no)
 if (condition 2) then (yes)
    :ACTION A;
    kill

I'd like to know if there is a way to connect the "yes" arrow from "condition 2" block to the "ACTION A" block of "condition 1". This is in order to avoid to repeat 2 times in the diagram the action block "ACTION A".

Thanks in advance

Regards

1 Answer

0 votes
answered Mar 24, 2025 by The-Lu (88,340 points)

Hello A.,

Here is an attempt:

start
if (condition 1) then (yes)
  label d
  label d
  label l
  :ACTION A;
  kill
else (no)
  if (condition 2) then (yes)
    label d
    goto l
  endif
endif

But the last kill does not work...

Regards,
Th.

commented May 17, 2025 by The-Lu (88,340 points)

But the last kill does not work...

Here is another proposal...

start
if (condition 1) then (yes)
  label d
  label d
  label l
  :ACTION A;
  kill
else (no)
  if (condition 2) then (yes)
    label d
    goto l
  else
  -[#transparent]->
  endif
endif

Enjoy,
Regards,
Th.

...