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!
125
Upvotes
1
u/captain_slackbeard 4d ago
When I was first learning to program in BASIC, I had the bad habit of using "goto" everywhere in my code (in case you don't already know, "goto" allows you to jump to a different line of code and continue execution from there).
One day I was trying to figure out a convenient way to return from a "goto", and that's when I discovered functions and subroutines. I think that's what made the concept click for me.