A function is a block of code that performs a specific task and can be reused whenever the function is called. Functions promote modularity and make code easier to maintain because logic is written once and invoked as needed. They typically accept input (parameters), contain processing logic, and may return an output. The correct answer reflects these characteristics. The other options describe an array, a single program statement, and a loop, none of which capture the core purpose of a function.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of using functions in programming?
Open an interactive chat with Bash
What are parameters and return values in functions?