A descriptive name for a subprogram can help you identify the purpose of that subprogram. After you define a name for your subprogram, you can fill it up with one or more commands that tell that subprogram what to do. So if you wanted to write a subprogram that prints your name onscreen, your main subprogram might look like this.

 

The preceding BASIC language example defines the beginning of a sub-program by using the SUB keyword followed by the subprogram’s name. The end of the subprogram is defined by the END SUB keywords. Not every language defines subprograms with keywords. In the  language family, the main program is called main and every subprogram is just given its own name.

 

Breaking a large program into multiple subprograms makes programming easier. Instead of trying to write a single, monolithic chunk of code, you just have to write small subprograms that work as building blocks that you can stack together to create a much larger program. Unfortunately, computer scientists found that just dividing a large program into multiple subprograms didn’t magically solve all the problems of creating software. Some of the most prominent problems of subprograms equation.