Skip to main content
All CollectionsCoding Sketches
Using Console for Debugging
Using Console for Debugging

Console on our code editor allows various ways to debug your code.

Sinan Ascioglu avatar
Written by Sinan Ascioglu
Updated over 11 months ago

Console is like your hidden communication tool between you and your project. You can output variables, messages that you want to see as your code runs in the browser, and the browser can also tell you back errors and warnings about your code without effecting the output of your project.


On OpenProcessing, console is hidden by default. Who need distractions when they are not needed, anyways? Console is automatically displayed when you send a message to it via one of the function below, or when browser wants to report you something, such as an error or a warning.


You can use functions below to print out messages to console:

print('This is a message');
console.log('This is a log message.'); //same as "print" above
console.warn('This is a warning.'); //yellow
console.info('This is an info.'); //blue
console.error('This is an error.'); //red, with a link to code

Particularly, you can use these to print out Objects and Arrays to further click into and explore their ingredients. Currently, there is a limit of 4 levels deep that you can explore on an object or array in the console.

AI-Assisted Debugging

Our console comes to your help with the new AI-assisted debugging feature. When an error is displayed, simply click on AI help to get your code analyzed by AI and get recommendations. Learn more about AI-Assisted debugging here.

Advanced

For more advanced debugging needs, you can still use the native browser console. To use the native console to communicate with your sketch, make sure you select the iframe your sketch is being run inside. 

Did this answer your question?