Wednesday, 10 June 2015

QTP - 16 - Difference between function and procedures.

Actions , Function and procrdure are used to break up the code into small logical units. It's designed to perform a particular activity.Actions are the inbuilt functionality of QTP which is used to break to modularize the code whicle actions and procedures are the VB functionality.

-> The basic difference between function and procedure is that the Function can return any Value while Procedure's can't.

-> Both of them can be called with or without arguments

-> Both of them can be called in the same way.
Eg : suppose we have a function and a procedure named Sum
we can call both of them in same way :
(a) call sum() 
(b) sum

-> To define a sub we use : 

Sub mysub(argument1,argument2)
  Print "my Sub Procedure"
End Sub


To define a function : 

Function myfunction(a,b)
myfunction=a+b  'assign value to function name
End Function



No comments:

Post a Comment