Entering and exiting states

Whenever a state is entered, it executes its entry action before any other action is executed. Whenever a state is exited, it executes its exit action as the final step prior to leaving the state.