March 2004
Intermediate to advanced
432 pages
7h 14m
English
A method is a collection of executable statements used to accomplish some task. Methods are the primary way to take action in a program.
A method is either a function or a subroutine. A subroutine performs some action and returns. For example:
Sub Main()
Console.WriteLine("Hello, world!")
End Sub
A function, on the other hand, calculates a value that is returned to the caller when the function ends. When a function is declared, it specifies the type of the value that it returns in much the same way that a variable specifies its type. For example, the following function calculates the sum of two numbers and returns the result.
Function Add(ByVal x As Integer, ByVal y As Integer) As Integer Return x + ...
Read now
Unlock full access