previous | start | next

## Procedures

- A function without a return value is called a procedure.

  >     print_time(now);

- The missing return value is indicated by the keyword `void`.

  >     void print_time(Time t)
  >     {
  >        cout << t.get_hours() << ":";
  >        if (t.get_minutes() < 10) cout << "0";
  >        cout << t.get_minutes() << ":";
  >        if (t.get_seconds() < 10) cout << "0";
  >        cout << t.get_seconds();
  >     }

- Since a procedure does not have a return value, it must have a side effect.
- Ideally, a procedure has only one side effect.

previous | start | next