programming

Definition

Def

A function is a self-contained unit of code designed to perform a specific task, characterised by its ability to accept input values (arguments) and produce an output value (return value). In the context of pure computation, a function represents a mapping from a domain of inputs to a codomain of outputs, ideally maintaining referential transparency.