terminology – What are the method, function, and procedure definitions?

Question:

I always thought the definitions were these, but it feels like I'm wrong:

  • functions: every procedure that returns something

  • methods: every procedure that returns nothing

  • procedure: it would be the basis of classification of the previous ones, something that executes instructions, whether with the intention of returning or not

I would like to know if these definitions are correct, and if they are not, or if they are partially correct, in what contexts these variations would occur.

Obviously, I'm only interested in definitions that exist in the world of programming… at best going a little towards mathematics.

Answer:

  • Procedure : Part of a program or class that does not return a value (from the Delphi/Pascal definition). In Visual Basic/VB.NET, it is also known as Subroutine ( Subroutine , or simply Sub );
  • Function : Part of a program or class that returns a value (from the Delphi/Pascal/Visual Basic/Visual Basic .NET definition);
  • Method : Procedure or function belonging to a class (various programming languages ​​define it this way, for example, , , , etc.).

There is an issue at Programmers where this is widely debated, but the consensus is that.

Scroll to Top