Name

boolean

Description

Datatype for the Boolean values true and false. It is common to use boolean values with control statements to determine the flow of a program. The first time a variable is written, it must be declared with a statement expressing its datatype.

Examples

  • 
    size(400,400);
    boolean a = false; 
    if (!a) { 
      rect(120, 80, 200, 200); 
    } 
    a = true; 
    if (a) { 
      line(80, 40, 360, 320); 
      line(80, 320, 360, 40); 
    } 
    
    Image output for example 1

Syntax

  • boolean var
  • boolean var = booleanvalue

Parameters

  • varvariable name referencing the value
  • booleanvaluetrue or false

Related