Function with parameters Learn programming Visual Basic (VB.net)

Lesson:

Functions


Exercise:

Function with parameters 51


Objetive:

Create a program whose Main must be like this:

public static void Main()
{
SayHello("John");
SayGoodbye();
}

SayHello and SayGoodbye are functions that you must define and that will be called from inside Main. As you can see in the example. SayHello must accept an string as a parameter.


Code:

Imports System
Public Class Exercise98
    Public Shared Sub SayHello(ByVal name As String)
        Console.WriteLine("Hello" & name)
    End Sub

    Public Shared Sub SayGoodBye()
        Console.WriteLine("Adios")
    End Sub

    Public Shared Sub Main(ByVal args As String())
        SayHello("Jonh")
        SayGoodBye()
    End Sub
End Class