A Sub procedure can be defined as a series of statements enclosed by sub and end sub.Sub-procedure is used to perform actions but does not return any value.Sub-procedure can accept parameters from caller of that sub-procedure.
Refer below syntax –
Public Sub Demo_sub()
Print “Call this QeWorks Procedure”
Public Sub Demo_sub1(argument1,argument2)
Print “Call this QeWorks Procedure by passing parameters”
Method to call Sub-procedure
A Function can be defined as s a series of statements, enclosed by the Function and End Function statements.Function s used to perform actions but can return a value.Function can accept parameters from caller of that Function.
Refer Below syntax-
Public Function myfunction()
Print “QeWorks-my function”
Public Function myfunction1(a,b)
myfunction1=a+b ‘method to return a value
Method call Function Procedures: Call myfunction
Procedure and functions are used to write the commonly used executable scipts. It helps to reduce the number of lines of code.