This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

boolean()

Examples
String s = "true";
boolean b = boolean(s);
if (b) {
  println("The boolean is true");
} else {
  println("The boolean is false");
}
Description Converts an int or String to its boolean representation. For an int, any non-zero value (positive or negative) evaluates to true, while zero evaluates to false. For a String, the value "true" evaluates to true, while any other value (including "false" or "hippopotamus") evaluates to false.

When an array of int or String values is passed in, then a boolean array of the same length is returned.
Updated on January 1, 2021 03:38:12am EST