Saturday 18 May 2013

difference between procedures and functions in vb script

Major difference between procedures and functions in vb script is that procedures can not return the value but functions can return the value.

Procedure Example -

Sub findsq()
   temp = InputBox("Please enter the number", 1)
   MsgBox "square root of the num is " & sqrt(temp)
End Sub


'Function Example
a = findsq()  ' function returns the value in variable a
msgbox a

function findsq()
 temp = InputBox("Please enter the number", 1)
findsq = sqrt(temp)
End function

No comments:

Post a Comment

Total Pageviews