For each state you can write code for the initialization section (Init / Entry), the cyclic section (Cyclic / Do) and the output behavior (Exit).

Activate a state in the diagram pane or Explorer to display the state code in code view.

Figure 71. Code View for a State

The input area for the code of states is divided into three sections, all of which are optional:

section initialization
    // Initialization
endsection
Between the section initialization and the endsection keywords, write the code for entering the state. This code is executed once. It can include both the assignment of values and the execution of functions.
section cyclic
    // cyclic part
endsection
Between the section cyclic and the endsection keywords, write the code to execute as long as the state is active.
section finalization
    // exit
endsection
Between the section finalization and the endsection keywords, write the code for activities to be executed once when leaving this state.

If you are sure that you do not need one or more of these areas of code, you can delete them.