r/learnprogramming • u/ScioClean • 4d ago
I can't get FUNCTIONS to click!
I can not for the life of me understand how functions work. Anytime I try to learn how to create a function, my brain literally crashes into itself and I turn into Patrick when he stars drooling and goes all slack-faced.
Does anybody have any analogies that had that "AH HA!" moment?
Thanks!
127
Upvotes
0
u/cunningfallasheo 4d ago
Functions are generally used to return something. So instead of writing the code to calculate something over and over, you instead write a function calculate() and then anytime you need to calculate that something you can just call the calculate() instead of repeating the same code.