MAXScript has several <expr> expression forms used for explicitly controlling the flow of execution. They are:
These expression forms correspond to the standard control constructs found in many programming languages. Each is described in its own topic:
Additionally, there are several constructs for implicitly controlling the program flow.
The when construct is used for scripting general change handlers, so you can write scripts that respond to user operations such as, object moves, vertex edits, object deletions, name changes, and so on. Callback mechanisms are used to have a function called when certain specific events occur. See Change Handlers and When Constructs for more information.
The on construct is used when scripting rollouts, tools, or plugins, so the script can respond to events that are often user-generated in those constructs. See Utility and Rollout Properties, Methods, and Event Handlers for more information.