โ† All Technology topics
Technology ยท Topic 38 of 118

Functions in Coding

A function is a named set of instructions that can be used again and again. Functions help keep code shorter and easier to read.

๐Ÿ’ก Fun fact

Almost every app is built from thousands of small functions.

All about Functions in Coding

A function is a named set of instructions that can be reused. Functions make code shorter, easier to read and easier to fix.

Instead of writing the same steps many times, you write them once inside a function and call it by its name whenever you need it. Functions can also take in information and give back a result.

If a game needs to draw a star in many places, one function called draw star can do the job each time. Breaking a big program into functions also makes it easier to find and fix mistakes.

๐ŸŽฎ Try it yourself!

Loadingโ€ฆ

Real-life uses of Functions in Coding

  • Reusing code in apps and games
  • Organising programs
  • Solving problems in smaller parts

Frequently asked questions about Functions in Coding

What is a function?

A named set of instructions you can reuse.

Why use functions?

They keep code tidy and reusable.