Function

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

Related concepts:  OperatorArgumentReturnMethod

Closest Wikipedia entry:  Subroutine — In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed. Functions may be defined within programs, or separately in libraries that can be used by many programs.

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.