Name

int

Description

Datatype for integers, numbers without a decimal point. Integers can be as large as 2,147,483,647 and as low as -2,147,483,648. They are stored as 32 bits of information. The first time a variable is written, it must be declared with a statement expressing its datatype. Subsequent uses of this variable must not reference the datatype because Processing will think the variable is being declared again.

Examples

  • int a;          // Declare variable 'a' of type int
    a = 23;         // Assign 'a' the value 23
    int b = -256;   // Declare variable 'b' and assign it the value -256
    int c = a + b;  // Declare variable 'c' and assign it the sum of 'a' and 'b'
    

Syntax

  • int var
  • int var = value

Parameters

  • varvariable name referencing the value
  • valueany integer value

Related