Understanding states and transitions
State diagrams are used to describe the states in a system and the transitions between the states. In this section, you will learn how to define states and transitions when using Mermaid. You will also learn about the different types of states you can define.
In a state diagram, there are two special states, called the Start state and the Stop state, indicating the beginning and the end of the execution of the state machine. They both share the same token in the code, [*]
. If a transition starts from the token, it is interpreted as a start state and if a transition ends at the token it is interpreted as an end state. The following example shows a small state machine only consisting of a start state and an end state:
stateDiagram [*] --> [*]
In the preceding code snippet, you can see that the diagram starts with the keyword stateDiagram
. This makes Mermaid understand that the diagram type for this diagram is a...