7.3. Subroutines: Methods That Do Not Return a Value
The programs presented earlier in the book each contain at least one method declaration that calls FCL methods (such as Console.WriteLine) to accomplish the program’s tasks. All of the methods that you have defined so far, such as DisplayMessage in class GradeBook, are known as subroutines—methods that perform tasks but do not return a value. Functions are methods that do return a value to the calling method. An example of a function that you have seen is Console.ReadLine, which returns to the caller the data entered by the user at the keyboard. We show how to declare functions in Section 7.4.
Consider the console application in Fig. 7.1, which uses a subroutine (invoked from the application’s ...
Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition 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.