Function

A function produces a return value from a list of argument values.

Related concepts:  OperatorParameterArgumentReturnMethod

Closest Wikipedia entry:  Subroutine — In computer programming, a function, procedure, method, subroutine, routine, or subprogram is a callable unit of software logic that has a well-defined interface and behavior and can be invoked multiple times. Callable units provide a powerful programming tool. The primary purpose is to allow for the decomposition of a large and/or complicated problem into chunks that have relatively low cognitive load and to assign the chunks meaningful names (unless they are anonymous).

Authoritative Definition

Wikipedia does not necessarily offer the best fitting definition of a concept. The exact meaning we attribute to the concept of Function is based on principled authoritative sources such as:

Misconceptions about Function
15 documented Misconceptions

Check Yourself
Misconception
ArrowFunctionNoImpliedReturnJavaScript
Even when an arrow function consists just of an expression, the return keyword must be explicitly written
Misconception
ArrowFunctionRequiresFunctionKeywordJavaScript
Arrow functions also require the keyword 'function'
Misconception
CallbackParametersInCallerJavaScript
Parameters of a callback function may be written as parameters of the caller function
Misconception
DeferredReturnPython
A return statement in the middle of a function doesn't return immediately
Misconception
FunctionAsValueWithParenthesesJavaScript
To use a function as a value, one needs to have parentheses after its name
Misconception
FunctionOverloadingJavaScript
It is possible to create multiple functions with the same name but with different signatures
Misconception
FunctionsCannotBeImmediatelyInvokedJavaScript
Functions cannot be called in the expression in which they are defined
Misconception
FunctionsMustBeNamedJavaScript
Every function definition requires an associated name
Misconception
MultipleValuesReturnPython
Functions can return multiple values
Misconception
NoFunctionCallsChainingJavaScript
It is not allowed to chain function calls
Misconception
NumberOfParametersMatchArgumentsJavaScript
Functions must be called with the same number of arguments as defined in their signature
Misconception
OutsideInFunctionNestingPython
Nested function calls are invoked outside in
Misconception
OutsideInMethodNestingJava
Nested method calls are invoked outside in
Misconception
ParenthesesOnlyIfArgumentPython
() are optional for function calls without arguments
Misconception
ReturnCallPython
Return statements need () around the return value

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.