Function

Functions hold a distinct place among the data types. They are blocks of code that yield results or perform a specific task. In some programming languages, they are processed as objects of data. This is because in some languages they are derived from objects and its closest classification is with composite data types.

Many languages treat functions as first-class objects, which means:

  • They can be assigned to variables.
  • They can be passed as arguments to or returned by other functions.

Functions in Different Languages

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn More on Codecademy