(noun) In programming (computer programming, that is), a coded series of programming instructions for carrying out some recurring or frequently used task in a program.

Informally, you could say that a routine is a way to wrap up some code you've written so that you only have to write it once instead of having to copy or re-write it in several different places in your program. This is an example of code reuse.

This word useage is similar to everyday useage, where "routine" refers to frequently recurring activities in Real Life.

Some programming languages give routines the formal names function, procedure or subroutine. Routines often encode algorithms.

Example: a routine (in BASIC) to take the value of variable X to the 10th power.


100 SUBROUTINE P10
110 LET X = X * X
120 LET X = X * X * X * X * X
130 RETURN