subroutine
A set of instructions inside a program that other code can call by name. It runs, then hands control back to the point where it was called.
Tell
code called, run, then returned from
Best when
You mean a callable, reusable piece of code in general, without saying whether it returns a value, belongs to an object or is triggered by an event.
Example
“The loop calls a subroutine to validate each entry.”
Branches
a block of code called by name
hands back a result
- function purpose, working, event or mapping
carries out steps only
- procedure the set steps for one task, in order
attached to an object or class
- method a planned way of getting it done
any fixed reusable block
- routine a fixed sequence done again and again
a self-contained part of a program
- subprogram any called part, kind left open
called when something happens
suspends or expands instead of returning
doing a small job for other code
- helper anyone who lends help
a piece of a larger job outside code
- subtask any piece of a larger task