This keyword is used to transition between states in a script. It's also used to define states, with the exception of the default state. State changes generally only happen in event handlers, although it's possible to hack around this limitation and transition from inside user-defined functions.

The maximum number of states a single script can support is 144 (including the default state). 144 is 128 + 16, both powers of two. Adding any states to a single script beyond 144 will generate a syntax error. To test this, create a script containing the contents below:

The above script will compile successfully. However, if you add a single additional state to it, the script will generate a syntax error during compilation, despite no "real" syntax error being present, and despite the script being well under the 16k script limit.Tax Consultant | Outsourcing IndonesiaFlow Control | state