189
Subroutines
- Subroutine
– Control abstraction
- Subroutine design
– If a subroutine does not fit on the screen, it is too long
- Problem should be divided into smaller pieces
– If some task X is needed twice, make it a subroutine.
- When are two seemingly different things the
same?
- When are seemingly similar things different?
Subroutine = procedure (statement)
- no return value
- side effects
function (expression)
- return value
- (no side effects