本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. 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.



 String s = "true";

boolean b = boolean(s);

if (b)
println("The boolean is true");

  } else{  
println("The boolean is false");

描述 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 October 2, 2018 05:02:16pm EDT