An expression is a series of values and operators that evaluate to a new value:
3 + 5 // => 8 size("Hello") // => 5 size("Hello")*2 // => 10 (10 > 5) // => 1 (5 > 10) // => 0
When using an expression inside MEL command syntax you must surround the expression with parentheses, and not use unquoted strings:
string $object = "cake"; setAttr $object.tx 2; // Wrong setAttr ($object + .tx) 2; // Wrong setAttr ($object + ".tx") 2; // Right
Maya also uses the word expression to refer specifically to bits of code you can attach to an attribute to drive animation.
A binary operator requires two operands, one before the operator and one after the operator:
operand1 operator operand2
3 + 4 $x = 5 $bool1 or $bool2
A unary operator requires a single operand, either before or after the operator:
operator operand
operand operator
$x++ // Increments the value of $x by one.
In addition, MEL has one ternary (three operand) operator:
condition ? exp1 : exp2
A statement is a structure of keywords and expressions that control the flow of the program:
if (condition) exp1 else exp2 while (condition) exp1
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License