Define and use Function : Function « Language Basics « VB.Net

Define and use Function

Define and use Function
Imports System

Public Class MainClass

    Shared Sub Main(ByVal args As String())
      PrintPay(40, 10.5)
      PrintPay(38, 21.75)
      PrintPay(20, 13)
      PrintPay(50, 14)
    End Sub

   Shared Sub PrintPay(ByVal hours As Double, ByVal wage As Decimal)
      Console.WriteLine("The payment is {0:C}", hours * wage)
   End Sub 

End Class


Related examples in the same category

1.Define and Call FunctionDefine and Call Function
2.Define and Use Function: Shared Function