How to add a snippet of code inside a state in a statechart?

0 votes
asked Mar 13, 2023 in Question / help by Mircea Trifan

1 Answer

0 votes
answered Mar 14, 2023 by The-Lu (64,340 points)

Hi M., and all,

Here is a proposal, according that state allows only mono-lines:

@startuml

[*] --> State1
State1 --> [*]
State1 : this is a string
State1 : adding **some code**:\n\
main() {\n\
  printf("Hello world");\n\
}

State1 -> State2
State2 --> [*]

@enduml

Ref.:

@PlantUML: similar to:

Here is a wanted feature:

  • Extend State syntax to allow multiline state

With this proposal:

@startuml

[*] --> State1
State1 --> [*]
State1 : this is a string
this is another string on multi-line;

State1 -> State2
State2 --> [*]

@enduml

If that make sense...

If that can help,
Regards.

...