what's the difference in between function and sub and give
some code as well
Answers were Sorted based on User's Feedback
Answer / kamesh
A Function procedure is a series of VBScript statements
enclosed by the Function and End Function statements. A
Function procedure is similar to a Sub procedure, but can
also return a value. A Function procedure can take arguments
a Function procedure has no arguments, its Function
statement must include an empty set of parentheses.
Function Celsius(fDegrees)
Celsius = (fDegrees - 32) * 5 / 9
End Function
A Sub procedure is a series of VBScript statements
(enclosed by Sub and End Sub statements) that perform
actions but don't return a value. A Sub procedure can take
arguments (constants, variables, or expressions that are
passed by a calling procedure). If a Sub procedure has no
arguments, its Sub statement must include an empty set of
parentheses ().
Sub ConvertTemp()
temp = InputBox("Please enter the temperature in degrees
F.", 1)
MsgBox "The temperature is " & Celsius(temp) & " degrees
C."
End Sub
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / venkatesh
Hello every body,
If you don't know the rite example No issue...
But please don't copy and paste QTP user guide examples..
Humble request for all
Thanks
Venkatesh
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / rachel wang
Nothing wrong to post a correct answer in any ways.
Of course 'QTP Online Help' provides the better answer, I
always look up QTP first.
- Rachel
| Is This Answer Correct ? | 2 Yes | 0 No |
How to handle Dynamically changing Objects in QTP?
what is the diff between manual test plan document and automation test plan doc.can u explain indetail.
What are the major/ important methods, functions in QTP we use realtime testing
What is the DIFF Between PROJECT AND PRODUCT?When Company will need Product?
Hi my name is mohan. I am working as a manual tester.. And now i want learn QTP.. is there any online websites to learn QTP for free if u know any plz help me out..,.or send mail to k.mohann.mohan@gmail.com
A web table is having 3 columns(name, salary and checkbox) in qtp How to select a checkbox based on the highest salary of an employee in a webtable.
Can you import and export data from XLS and how?
Give me exact application where we should use low level recording?
How to use userdifined environment variables.Once we created in Environment tab which is at File--> Settings-- >Environment-->Userdifined
What is object identification?
Can u Reduce the size of Object repository? What are the problems u have faced in Qtp tool?
Can we set a timeout for the msgbox.I want the msgbox to disappear after 2 seconds during the script execution without clicking on the OK button manually.