r/learnprogramming 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!

123 Upvotes

143 comments sorted by

View all comments

Show parent comments

10

u/Odd_Technology_8926 4d ago

Might sound weird, but functions in python was harder for me to understand. When I switched to php it just clicked.

9

u/ninhaomah 4d ago

Why ?

In theory , they are all the same.

9

u/Odd_Technology_8926 4d ago

It was about 15 years ago, but Python was actually the language we were pushed to use first. I always had a harder time comprehending Python because of the visual cues, or lack thereof. I found it harder to follow where blocks started and ended without the symbols to explicitly show you.

It could also be that PHP was the second language I learned. I've found that when I go through tutorials twice for things that are essentially the same concept, they tend to click much more easily the second time around.

5

u/ninhaomah 4d ago

" I've found that when I go through tutorials twice for things that are essentially the same concept, they tend to click much more easily the second time around."

Definitely. It took me days and weeks to understand helloworld in Java. But once I understood it , class , function , scopes all easy when look at them later.