This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name | ### byte
Examples |
    // Declare variable 'a' of type byte
    byte a;

    // Assign 23 to 'a'
    a = 23;

    // Declare variable 'b' and assign it the value -128
    byte b = -128;

    // Declare variable 'c' and assign it the sum of 'a' and 'b'.
    // By default, when two bytes are added, they are converted
    // to an integer. To keep the answer as a byte, cast them
    // to a byte with the byte() conversion function
    byte c = byte(a + b);
Description | Datatype for bytes, 8 bits of information storing numerical values from 127 to -128. Bytes are a convenient datatype for sending information to and from the serial port and for representing letters in a simpler format than the char datatype. 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.
Syntax |
    byte var
    byte var = value
Parameters |
var | variable name referencing the value
value | a number between 127 to -128
Related | int float boolean

Updated on May 19, 2014 05:30:05pm PDT