Again, this is exactly equivalent to the previous two examples.
Notice in this one that we have parentheses () surrounding resolved
and rejected. They are actually completely ignored by the parser, and
you can use them as you please to help make your charts more readable.
A description of all the states in a machine, plus all of the permitted transitions between them.
This is defined using a
stringor anarrayof strings, but Template Literals are much more convenient.An arrow
->configures a permitted transition between two states:It's the only operator needed to build any chart:
The "OR" operator
|can help us remove some redundancy from the above example:In both charts,
pendingcan transition toresolvedorrejected, andresolvedorrejectedcan both transition todone.We can streamline this even further:
Again, this is exactly equivalent to the previous two examples.
Notice in this one that we have parentheses
()surroundingresolvedandrejected. They are actually completely ignored by the parser, and you can use them as you please to help make your charts more readable.A chart works exactly the same without them:
Charts can also be split across multiple-lines:
Notice that all white-space is ignored on either side of the
->and|.// Comments of this kind are allowed, too:Finally, here's a more full example: