1. An activity or purpose natural to or intended for a person or thing
  2. In Mathematics - A relationship or expression involving one or more variables
  3. In Programming (computer science) - A relationship or expression involving one or more variables. The result of the operation returning a result.

In mathematics the purpose of a function is to perform an operation and to return a result. In programming the same is true with the caveat that the function may not always return a result.

This is actually ambiguous as the function will generally affect something external, for example sending the output to the screen or a database. Some programming languages require some sort of return from a function explicitly, even if that return is specified as empty, null or void. Some languages have another term for a function that does not return a value known as a sub procedure however, many languages have allowed functions to return a value implicitly and have depreciated the sub procedure.

Most lower languages require that the input and the output be of the same data type. In fact all actually do however, many higher languages actually deal in variant or object data types and the interpreter makes a determination about the data based on it's content.

Subscribe to Function