Reference for Processing version 1.5. 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

### print()

Examples

    print("begin- ");
    float f = 0.3;
    int i = 1024;
    print("f is " + f + " and i is " + 1024);
    String s = " -end";
    println(s);

    // The above code prints:
    // begin- f is 0.3 and i is 1024 -end

Description

Writes to the console area of the Processing environment. This is often helpful for looking at the data a program is producing. The companion function println() works like print(), but creates a new line of text for each call to the function. Individual elements can be separated with quotes ("") and joined with the addition operator (+).
Beginning with release 0125, to print the contents of an array, use println(). There's no sensible way to do a print() of an array, because there are too many possibilities for how to separate the data (spaces, commas, etc). If you want to print an array as a single line, use join(). With join(), you can choose any delimiter you like and print() the result.
Using print() on an object will output null, a memory location that may look like "@10be08," or the result of the toString() method from the object that's being printed. Advanced users who want more useful output when calling print() on their own classes can add a toString() method to the class that returns a String.

Syntax

    print(data)

Parameters

data | boolean, byte, char, color, int, float, String, Object

Usage | IDE
Related | println() null join()

Updated on August 30, 2010 04:29:39pm EDT