Question

I want to know how to return a value in a sequence diagram, for example:

if(a>b) return true; 
else return false;
Was it helpful?

Solution

Here are two variants.

lighter variant        heavier variant

Please, notice, that dashed line means returning message. Solid line with parameters - calling message.

Full triangle arrow head means synchronous call. Line angle triangle arrow head means asychronous call. But in the return message arrow ALWAYS has such head.

But if you really have so light cases as you have shown, it's better to use "alt" combined fragment directly, without all these three messages. Simply show in its two operands what you really do in these two branches.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top