Functions

Big Idea:  User-defined functions are another great tool at our disposal.

Intuition:  Let's rely on the fact that we've already been a *user* of functions and made function calls and made use of the values that are returned.  What is new here is how we go about being the *author* of a function.

I also tend to think about a function as an "assistant" for which we can delegate a task. The assistant will do all the work, but we still need to think carefully about what instructions and information we send to the assistant, what work we expect the assistant to do, and how information might be conveyed back to us.

Let's focus on two distinct aspects of the new material.

1) Syntax/Semantics

2) Advantage of functions in good software design

Common questions/confusions:

Examples:


Michael Goldwasser
Last modified: Sunday, 22 December 2019