Function
A named, reusable set of instructions.
๐ In simple words
A named, reusable set of instructions.
๐ Technical definition
A self-contained block of code that takes parameters, performs a task and can return a value; it runs only when called.
Pseudocode example
1FUNCTION SQUARE(N)2 RETURN N * N3END FUNCTION4DISPLAY SQUARE(4)
๐ Real-world analogy
A blender: put things in, press a button, get a smoothie out.