Chapter 9. Controlling the Flow of Execution

In this chapter you will learn

  • What it means to control the flow of execution.

  • How conditional operations work.

  • How if/then/else statements work.

  • How switch statements work.

  • How tests work.

  • About loops, including for, for-in, and while loops.

Controlling the Flow of Script Execution

Most of the scripts discussed this far have run from beginning to end. However, many useful scripts either need to do something repeatedly or do certain things only if certain preconditions are satisfied. When a part of your script should only be run if certain conditions have been met, you can use a feature of MEL called a conditional operation to allow your script to decide whether to run that code.

When a part of your script should ...

Get MEL Scripting for Maya Animators, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.