- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

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

Name | ### print()
Examples |
    String s = "The size is ";
    int w = 1920;
    int h = 1080;
    print(s);
    print(w, "x", h);

    // This program writes to the console:
    // The size is 1920 x 1080
    print("begin- ");
    float f = 0.3;
    int i = 1024;
    print("f is " + f + " and i is " + 1024);
    String s = " -end";
    println(s);

    // This program writes to the console:
    // "begin- f is 0.3 and i is 1024 -end"
Description | The print() function writes to the console area, the black rectangle at the bottom of the Processing environment. This function 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. More than one parameter can be passed into the function by separating them with commas. Alternatively, individual elements can be separated with quotes ("") and joined with the addition operator (+). 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. Note that the console is relatively slow. It works well for occasional messages, but does not support high-speed, real-time output (such as at 60 frames per second). It should also be noted, that a print() within a for loop can sometimes lock up the program, and cause the sketch to freeze.
Syntax |
    print(what)
    print(variables)
Parameters |
what | String, float, char, boolean, or byte: data to print to console
variables | Object[]: list of data, separated by commas
Returns | void
Related | println() printArray() join()

Updated on January 1, 2021 03:38:06am EST
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.