GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Processing
  • Download
  • Reference
  • Environment
  • Libraries
  • Tools
  • Wiki
  • Tutorials
  • Examples
  • Books
  • Forum
  • Overview
  • People
  • Privacy

This view

  • Original page
  • New address

GeezerVison is showing processing.org — byte / Reference

Reference+
Documentation→Reference→Data→Primitive

Name

byte

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.

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);
    

Syntax

  • byte var
  • byte var = value

Parameters

  • varvariable name referencing the value
  • valuea number between 127 to ‑128

Related

  • int
  • float
  • boolean
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.