Reference+
Name
boolean()
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.
Examples
String s = "true"; boolean b = boolean(s); if (b) { println("The boolean is true"); } else { println("The boolean is false"); }
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.