Programming Concepts Tutorial

Learn the fundamental concepts of computer programming

Functions

Functions

A function is a block of reusable code designed to perform a particular task. A function is executed when something "calls" or "invokes" it.

Why Use Functions?

  • Reusability: Write the code once, use it many times.
  • Organization: Functions help break large programs into smaller, manageable chunks.

Parameters and Arguments

Functions can accept input values called parameters. When you call the function, the actual data you pass in are called arguments.

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics