Reference+
Name
! (logical NOT)
Description
Inverts the Boolean value of an expression. Returns true if the expression is false and returns false if the expression is true. If the expression (a>b) evaluates to true, then !(a>b) evaluates to false.
Examples
size(400, 400); boolean a = false; if (!a) { rect(120, 80, 200, 200); } if (a) { line(80, 40, 360, 320); line(80, 320, 360, 40); }
size(400, 400); boolean a = true; if (!a) { rect(120, 80, 200, 200); } if (a) { line(80, 40, 360, 320); line(80, 320, 360, 40); }
Syntax
!expression
Parameters
expression
any valid expression
Related
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.