The print() function in p5.js writes the content on console area of the web browser. It is helpful for looking at the data a program is producing which helps in debugging the code. The elements can be separated by using quotes (“”) and joined with the addition operator (+). Use print(‘\n’) to display blank line.
Parameters: The function accepts single parameter c which stores the any combination of Number, String, Object, Boolean, Array to print.
Below program illustrates the print() function in p5.js:
Example 1: This example uses print() function to display the content on console.
Example 2: This example uses print() function to display the content on console.
- PHP | echo and print
- How to add innerHTML to print page?
- Print PHP Call Stack
- How to print variable to the terminal in SASS ?
- PHP str_pad to print string patterns
- PHP | Print the last value of an array without affecting the pointer
- What is the difference between echo, print, and print_r in PHP?
- How to print console without trailing newline in Node.js ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.