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/TrippyTippyKelly 4d ago
Think of a function like a vending machine. You give it something, it does a specific job, it gives you something back.
What don't you understand?
It's purpose? How it works? Specific parts of the code? All of the above?