Mega Code Archive

 
Categories / VisualBasic Script / Language Basics
 

Passing Arguments to Subroutines and Functions

Sub ThreeNumbers()     Dim num1 As Integer, num2 As Integer, num3 As Integer     num1 = 10     num2 = 20     num3 = 30     MsgBox MyAverage(num1, num2, num3)     MsgBox num1     MsgBox num2     MsgBox num3 End Sub Function MyAverage(ByVal num1, ByVal num2, ByVal num3)     num1 = num1 + 1     MyAverage = (num1 + num2 + num3) / 3 End Function