Each state is named as it is created. A state must not have the same name as another state in the same module; however, it is legal (although may be confusing) for a state to have the same name as a module, variable, function, or state in another module. State names can contain all the same characters as a variable name, or may also be a positive integer value. In the case of numeric state names, a negative sign is not permitted in the name nor are any characters other than the digits from 0 to 9. The following are legal state names:
A
Shipping_Department
1234567890123
9
The following are illegal state names:
Off&On
-32
In the first example, "&" is not an alphabetic character; in the second, the name is a negative number, which is illegal.
States are composed of functions and actions. Functions give the instructions that are always in effect when the state containing the function is active. Actions give the conditions that cause the active state to change and the script to perform when the state changes.
You will often see modules that contain states named "INIT" and "MAIN". There is no governing these names, but by custom, INIT is used for initialization tasks and MAIN is used for the state that forms the main body of the module.
In general, state names should be:
• Short
• Descriptive - of the state's purpose
• Verbs - when the state performs a task.