A function is a reusable block of code that performs a specific task and can be invoked by name. Functions improve modularity, readability, and reuse. They may accept parameters and return values. Example: A function that calculates the average of numbers.