User-defined functions allow programmers to define reusable blocks of code to perform tasks. Functions are defined using the function keyword followed by a name and parameters. Code within the function body is executed when the function is called. Functions may take arguments, have default values, return values, and be called recursively. Functions can also be defined inside other functions.