Function

Function image
In programming, a function is a reusable block of code.

Think of it like a cardboard box on a production line with a simple name written on the side like “tie knot” - this function accepts a ribbon and produces the same ribbon with a particular kind of knot tied in it. Other functions might not accept any input, but produce an output of a similar format over and over again, or accept an optional input. The most important thing to remember is that functions should be re-usable and best practice follows that functions should only do one thing, making the code easier to maintain and test.

There are two types of functions - ones built into the programming language you are using like 
.split(" ")
in TypeScript which can be applied to a string to split it by its input (in this case a space, making the function split by word), and ones you define yourself. Every function you define must have a unique name.
Explore MoT
MoT Athens image
Fri, 5 Jun
MoT Athens Meetup #18: Summer meetup 2026
MoT Software Testing Essentials Certificate image
Boost your career in software testing with the MoT Software Testing Essentials Certificate. Learn essential skills, from basic testing techniques to advanced risk analysis, crafted by industry experts.
Into The Motaverse image
Into the MoTaverse is a podcast by Ministry of Testing, hosted by Rosie Sherry, exploring the people, insights, and systems shaping quality in modern software teams.
Subscribe to our newsletter