On Clauses
An On Clause specifies how to handle a particular kind of message or situation as part of the definition of a [handler](/concepts/handler/. An On Clause is associated with a specific message definition and contains statements that define the handling of that message by the handler’s parent. An On Clause is also optionally associated with an entity or pipe) as the sender of a message.
There are fours kinds of On Clauses:
- Initialization - when the definition is created and initialized
- Termination - when the definition is terminated
- Message - when the definition receives a specific kind of message
- Other - whenthe definition receives a message not otherwise handled
- Handlers - the handler to which the On clause is applied
- Statement - specifies what should happen when the event occurs