Boolean values

 
 
 

MEL uses 1 to represent true and 0 to represent false. When operators return boolean values, they use 1 or 0.

MEL also lets you use true and false as well as on and off for boolean values to help readability.

In a logical operator, any non-zero value evaluates to true (1), and zero (0) evaluates to false. However, remember that in MEL, a value may evaluate to true, but not be equal to true:

int $xsv = 5;
if ($xsv) print("true\n"); // True
if (true) print("true\n"); // True
if ($xsv == true) print("true\n"); // False

Avoid trying to compare values to “true”.

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