In programming a function is a bit of code that waits around until its service is called upon. When called it performs a pre-programmed task. This task can be anything.

A function often requires an input such as a variable and often returns an output.

For example a simple function to add up two numbers would require the input of number A and number B (the two numbers). It would do the math and return a total figure, C.

Programming languages come with a lot of built in functions but you can also create your own.

Leave a Reply