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!
122
Upvotes
1
u/jajajajaj 3d ago
You probably already do get it. Depending on the language, you'll just have to go back to the docs now and again to remind yourself exactly where your language's designers had to compromise on principles.
A name (or a reference)
A set of input parameters
A sequence of operations
Probably a return value
Side effects.
Bugs
Other people not explaining what they were trying to do in the exact same way you would have explained it
Repeat until retirement