5.3: Functions and Return – p5.js Tutorial

This video covers what it means for a function to return a value.

Next video:

Support this channel on Patreon:


Send me your questions and coding challenges!:

Link to code on Github:


For More p5.js Videos:

Help us caption & translate this video!






20 responses to “5.3: Functions and Return – p5.js Tutorial”

  1. SogMosee Avatar

    I love this guy!

  2. MNation Avatar

    Do you Have Any courses on programming?

  3. baby on rocks Avatar

    dude u re awesum…u make this coding stuff much easy to understand thn it was before whether it s treehouse or anything …u re d bst teacher ..hats off man

  4. SimonJStorm Avatar

    11:50 "I don't ever see love, now how do i deal with that problem" – learning about coding and life on this channel, much love to you Dan <3 Excellent video as always!

  5. Tracybeme Avatar

    "Oh man, this camera keeps turning off" what's the counter value for this statement?

  6. Tracybeme Avatar

    The function print(); calls the printer window; println(); is not recognized.

  7. Rob Molloy Avatar

    Hi, I really struggled to get this to work but got this answer from 'GoToLoop' on the processing forum which really helped me.

    " Function println() was removed from p5.js' API!
    Replace it w/ print(). Or use console.log() or console.info(), etc.

    BtW, hit F12 to open browser's developer tool. Then go to the console tab, so you can see whether any errors happened or not. "

    I may be the only person to not realise you had to use the console in the browser.

  8. Lauge Rønberg Avatar

    i made a BMI calculator using weight and height as arguments 😉 (i feel proud…)

  9. Da-mel Melton Avatar

    What is a function ?

  10. Red_Psy Avatar

    A couple things have changed in p5 since these videos were released – println() for example. It's probably good practice to just go and check the reference if you are using a p5 function and you get errors such as "not defined". Quick and easy way to double check your code!

  11. Alvaro Morales Avatar

    3: Uncaught ReferenceError: println is not defined

  12. tomilo Avatar

    i have made this button maker, after whatcing only your videos

    var rectBotton = function(x,y,s){
    return mouseX > x-s/2 && mouseX < x+s/2 && mouseY > y-s/2 && mouseY < y+s/2;

  13. Random Avatar

    p5 console doesn't work need to see what thats about
    seems like and odd problem
    ;S " println is not defined " written on the browser console …
    Must re install this or am I missing libraries?
    the console used to work something is missing i guess.
    plus some of the previous lessons.js are damaged / not working…
    I will re install p5

  14. Dignity Freerun Avatar

    My console keeps telling "println is not defined". Is there something I need to enable in de libs?

  15. trinakriae Avatar

    How comes that 26.3 * 1.6 is not equal to simply 42.08? That's the correct result

  16. Shuhao Shang Avatar

    Mile is lager than KM.
    Is that actually,
    var miles = km*1.6 ?
    return miles or km?

  17. Julian Puppo Avatar

    I think your camara is an agent of evilness and destruction that doesn´t want the world to learn p5.js

  18. deepank verma Avatar

    A quick question ,however, I want to store the pressed key in an array order wise, first pressed key first. Any handy solutions?
    I've tried almost everything.

  19. deepank verma Avatar

    couldn't have been better.

Leave a Reply

Your email address will not be published. Required fields are marked *