What is Argument / Parameter ?

Ans :

☞ Argument : is the actual value of this variable that gets passed to function.

Ex : Test(5,7)

☞ Parameter : is variable in the declaration of function.

Ex : Test(X,Y)

⚝ Function Example :

⚝ Argument Example

Sub Argument()

Dim Result As Integer

Result = Test(5,7)

Msgbox Result

End Sub
Function Test(X,Y)
Test = (X+Y)
End Function


⚝ Parameter Example

⚝ Procedure Example :

Public Result As Long

Sub Test1()
Call
 Test(5,7)

MsgBox Result

'Output = 12
End Sub

Sub Test(X, Y)
Result = X + Y

MsgBox Result

'Output = 12
End Sub


Note : Output will be 12 in Test1 and Test Procedure Because Result Variable Data Type is "Public

Post a Comment

Previous Post Next Post