A function is a rule that assigns to each input exactly one output. You can think of a function as a machine: for every input you give it, the machine produces an output according to a specific rule.
Example
The rule is: \(\textcolor{olive}{\text{add 2}}\).
The input is: \(\textcolor{colordef}{3}\).
The output is: \(\textcolor{colordef}{3}\textcolor{olive}{+2} =\textcolor{colorprop}{5}\).