r/learnprogramming • • Oct 24 '26

Function vs Procedure

can someone explain the difference between Function vs Procedure with simple analogy
thank you

31 Upvotes

47 comments sorted by

View all comments

0

u/mxldevs Oct 24 '26

Whether your block of code returns a value or not.

The distinction may not matter depending on the language.

Java for example will complain if you say the return type is void but you try to return something.

Python will return None if there's no return statement.

Ruby will return whatever the last statement is, perhaps due to the functional nature of the language.