Chapter 35 Introduction to Subprograms
35.1 What Exactly is a Subprogram?
In computer science, a subprogram is a block of statements packaged as a unit that performs a specific task. A subprogram can be called several times within a program, whenever that specific task needs to be performed.
In C#, a built-in method is an example of such a subprogram. Take the well-known Math.Abs() method, for example. It consists of a block of statements packaged as a unit under the name “Abs”, and it performs a specific task—it returns the absolute value of a number.
If you are wondering what kind of statements might exist inside the method Math.Abs(), here ...
Get C# and Algorithmic Thinking for the Complete Beginner now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.