Subroutine
A subroutine is a named sequence of program instructions that can be invoked from multiple points in a program. It accepts inputs, called parameters or arguments, and transfers control back to the caller when finished. Subroutines help modularize code, promote reuse, and reduce duplication by encapsulating a task in a single, reusable unit.
Historically, the term subroutine comes from early programming language design, where it competed with terms such
Implementation and behavior vary by language, but a subroutine generally has an interface (a name and a