When to use indentation


#1

I’m unclear about exactly when to use indentation: is there something somewhere that will guide me?


#2

Hey Danny—

There are two cases when you’ll want to use indentation:

  1. Adding a transition between states. You indent the transition two spaces underneath the parent where the transition starts (and the event is fired).

  2. Nesting states in other states. If you indent a state two spaces underneath another state, it’s now considered a “child” of the unindented state. The use case for this is most commonly to reduce repetition, it’s covered towards the end of the five minute introduction. (I really need to enable deep linking on the tutorials :slight_smile: )

I made a little sketch here that hopefully makes it clearer. Let me know if that helps.