VOOZH about

URL: https://processing.org/reference/logicalnot

⇱ ! (logical NOT) / Reference / Processing.org


Reference+
DocumentationReferenceControlLogical Operators

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

  • expressionany valid expression