Function: meaning, definitions and examples
⚙️
function
[ ˈfʌŋkʃən ]
computer programming
A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and allow you to break your program into smaller, more manageable pieces.
Synonyms
method, procedure, subroutine.
Which Synonym Should You Choose?
Word | Description / Examples |
---|---|
function |
Used in mathematics, programming, and computer science to describe a block of code that performs a specific task and returns a value. Often found in formal or technical contexts.
|
method |
In object-oriented programming, a method is a function that is associated with an object and can operate on the data contained in the object. Also, 'method' can refer to systematic processes in broader contexts.
|
procedure |
Commonly used in procedural programming to describe a block of code that performs a task but does not return a value. Also, 'procedure' can refer to a formal way of doing something in different fields like law or medicine.
|
subroutine |
An old-fashioned term mostly used in early programming languages like FORTRAN or COBOL. It refers to a sequence of program instructions that perform a task, packaged as a unit. It is generally less common in modern programming.
|
Examples of usage
- Example 1: In JavaScript, you can define a function using the 'function' keyword.
- Example 2: The main advantage of using functions is that you can reuse the same code multiple times without rewriting it.
mathematics
In mathematics, a function is a relation between a set of inputs and a set of possible outputs where each input is related to exactly one output.
Synonyms
mapping, operation, transformation.
Which Synonym Should You Choose?
Word | Description / Examples |
---|---|
function |
Used in mathematics and programming to describe a relation between a set of inputs and a set of outputs, where each input is related to exactly one output.
|
mapping |
Commonly used in mathematics and sciences to describe the process of linking or associating one set of items with another.
|
operation |
Used in mathematics and computing to describe a process or action, often involving mathematical calculations or logical processes.
|
transformation |
Often used in mathematics, data science, and other scientific fields to describe a thorough or significant change in form, structure, or appearance.
|
Examples of usage
- Example 1: The function f(x) = x^2 is a simple mathematical function that squares its input.
- Example 2: Functions are used in calculus to describe how one quantity changes in relation to another.
general
To function means to work or operate in a particular way. It can also refer to the normal or proper working of something.
Synonyms
Which Synonym Should You Choose?
Word | Description / Examples |
---|---|
function |
Can also refer to an official event or ceremony.
|
operate |
Use when talking about the physical control or management of a machine or system, or more broadly, how an organization or entity works.
|
perform |
Use when discussing the execution of an action, task, or duty, often in a context where skill or precision is required.
|
run |
Use when discussing the management or control of a system, program, or event, or when something is in operation over a period of time.
|
Examples of usage
- Example 1: The machine stopped functioning properly after years of use.
- Example 2: It is important for all parts of a team to function well together for success.
Translations
Translations of the word "function" in other languages:
🇵🇹 função
🇮🇳 कार्य
🇩🇪 Funktion
🇮🇩 fungsi
🇺🇦 функція
🇵🇱 funkcja
🇯🇵 機能 (きのう)
🇫🇷 fonction
🇪🇸 función
🇹🇷 işlev
🇰🇷 기능
🇸🇦 وظيفة
🇨🇿 funkce
🇸🇰 funkcia
🇨🇳 功能 (gōngnéng)
🇸🇮 funkcija
🇮🇸 virkni
🇰🇿 функция
🇬🇪 ფუნქცია
🇦🇿 funksiya
🇲🇽 función
Etymology
The word 'function' has its origin in the Latin word 'functio' which means performance or execution. It first appeared in English in the 16th century with the meaning of official or formal ceremony. Over time, it evolved to encompass the concept of a task or duty to be performed. In modern usage, 'function' is widely used in the fields of mathematics, computer programming, and general language to denote a specific action or operation.