Using white space

 
 
 

You can improve the format of your MEL scripts with proper use of white space and comments. Both make the script easier to read and understand.

You must insert at least one space between keywords and variables. Other than that, white space is used only to organize your script into a readable format.

White space includes spaces, tab characters, and blank lines. When you add white space to a script, the execution of the script is not affected. However, use of white space can greatly increase the readability of your script.

For example, consider the following problematic MEL script:

int 			$scale = 0; 
string 
$text; if (rand(10 ) <
 1){ $scale = 
10; $text = "Exceptional scaling";} else $text = 
"Default scaling";

Technically, the above example is correct. However, the format makes it difficult to read. You can use spaces, tabs, and blank lines to make the script more understandable. Here is the same script with better use of white space:

int $scale = 0;
string $text;
if (rand(10) < 1) {
 $scale = 10;
 $text = "Exceptional scaling";
}
else 
 $text = "Default scaling";