Functions

3 class hours

Functions

  • Library- or programmer-defined instructions.
  • A meaningful abstraction: One, concise, meaningful task.
  • Anatomy of a function: return type, name, parameter list, body.
  • Design Recipe I

Slides

Testing

  • Manually, by printing values and checking against the expected ones.
  • Automated, using cp::check. Crashes if the actual result does not match the expected ones.

Slides

Previous
Next