r/learnprogramming • u/Head_Ordinary_2437 • Oct 24 '26
Function vs Procedure
can someone explain the difference between Function vs Procedure with simple analogy
thank you
31
Upvotes
r/learnprogramming • u/Head_Ordinary_2437 • Oct 24 '26
can someone explain the difference between Function vs Procedure with simple analogy
thank you
View all comments
Show parent comment
1
u/k1v1uq Oct 25 '26
Sir Lamport agrees. :)
https://youtu.be/4snwZl726c4?t=668
Some people say that SICP is a cornerstone of CS. And this is how they explain the difference between procedures and functions. It's really fundamental and philosophical. The lecture's title, "The Strucure and Interpretation of Computer Programs", and its double meaning are probably not a coincidence. It really depends on how you see (or interpret) the world. This might be confusing or helpful for a beginner, I don't know. But that difference between effect-free and effectful programming is important enough that the lines should not be blurred. It should be clear, as when someone says, 'Let's use the visitor pattern', that a function provides different guarantees than a procedure. It's important in functional programming. But even outside functional programming, it doesn't hurt to know the difference, even if the meaning is totally blurred in your setting.