Comments

 
 
 

Use comments to document your scripts. Leave yourself notes about what variables are for and what each section of code is doing. This will make it much easier to maintain the code later.

Everything on a line after a double-slash (//) is considered a comment and ignored by MEL (except inside strings, of course).

// This is a comment.
print(5 + 10); // This is a comment too.

You can comment out an arbitrary block of code by surrounding it with/* and */.

/*
This is a multi-line comment.
You can type as much text in here as you want.
*/

Freeform comments cannot be nested:

/*
This is a comment.
/* Sorry, you can't put a comment inside a comment. */
You'll get a syntax error here.
*/

This type of comment doesn’t work in animation expressions. Only // works in expressions.

Note

Sourcing a MEL script that has an unterminated comment (/* comment [without the final */]) will cause Maya to go into an infinite loop and must be killed by the operating system.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License