QamoosTech
Programming FundamentalsBeginner

Function

PronunciationFUNK-shun

Definition

A reusable block of code that does one job. You give it inputs and it can return a result.

Where you hear it

Everywhere: "call the function", "extract this into a function", "pure function".

Examples

  • Extract the validation logic into its own function.
  • This function returns null when the user is not found.

Common mistake

Writing one huge function that does many things. A function should do one thing and be easy to name.