Lesson 017

Functions & Procedures

Parameters · Return Values · Reuse

1:00

How to bundle reusable steps into functions, pass inputs as arguments, get results back via return values, and keep variables isolated with local scope.

By the end, you can

  • Explain what a function is and why it is preferable to copying code.
  • Identify the four structural parts of a function definition.
  • Trace the call/return flow: call → bind arguments → run body → return value.
  • Distinguish parameters (definition placeholders) from arguments (values at the call).
  • Explain what a return value is, and why lines after return never execute.
  • Distinguish a function (returns a value) from a procedure (returns nothing).
  • Describe local scope and predict what happens when a local variable is used outside its function.
  • Apply the DRY principle and explain why functions support it.
  • Diagnose the "no return" bug and the "missing argument" bug, and fix both.
Up next in Programming Foundations
Questions or feedback?