DELAPARRA
Index
Color
NL
Category: Core glossary

Function

Explained by Updated

What is Function?

Function: A named block of reusable code that performs a specific task. In functional programming, a pure function produces the same output for the same input and has no side effects. A function is a named block of code that performs one task and can be reused. It takes input through parameters and usually returns a result, like calculateVat($amount).

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Function

How is Function used in practice?

Good functions are small and do one thing, with a name that says what. A reader should understand the purpose from the name and parameters without reading the body.

What should you keep in mind with Function?

A pure function always returns the same output for the same input and changes nothing outside itself. Pure functions are the easiest code to test and reason about. Real applications need side effects, such as saving data or sending email. A good structure keeps those at the edges, while the calculations and decisions in the middle stay in pure functions you can test without a database.

At a glance

CategoryCore glossary
Explained by
Updated

More Core glossary terms

All terms starting with F

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.