Module 5 · Functions: Declarations, Arrows, Defaults and Rest
Full Programs: A Small Library, Functions as Values and Recursion
Free with an accountReading
Amara's shop program started as ten tidy lines. Two years later it is one loop of forty lines. It reads items, adds them up, takes off a discount, adds VAT and prints the receipt. Every new feature breaks an old one, because every line can see and change every other line. Bob is scared to touch it. This lesson writes the same kind of work as small functions, each with one job, and then grows six more programs from the same habit.
Checking what this lesson needs for you…
What is inside Full Programs: A Small Library, Functions as Values and Recursion
- Three shapes these programs use
- A small library of five functions
- A function that times another
- A function that returns a function
- Recursion: a function that calls itself Intermediate
- Rest parameters: sum or average anything
- The realistic one: a marks report