what's the difference in between function and sub and give
some code as well
Answer Posted / 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 |
Post New Answer View All Answers
I want to open a Notepad window without recording a test and I do not want to use System utility Run command as well. How do I do this?
What is the difference between rational rose and QTP?
How do we handle run-time errors?
Could any one tell me "How can i recognize my cursor position using QTP 9.2" Give me a scripts for this
Which is the best QTP training institute in Delhi/NCR region and what is the approximate fee for QTP course (Basics and Advanced)
How many types of trigger events are there in qtp?
How can you identify the browser and its information using QTP script?
How to add synchronisation points in qtp?
how to test load test and block box testing an a web based application pls give ans briefly
Hi frnds, does anybody know if there is anything called "thin point" or something in qtp? thanks in advance.
In keyward driven framework what will be the step for yahoo login page ,inbox logout,plz explain in detail
How many number of actions possible in qtp?
What are the various automation frameworks available in qtp?
How does qtp identify gui object?
Can any one brief some detail on how the shared and action object repository utilized/implemented in a real time project. I already know how to make shared object repositor by saving OR as .tsr extension..I wanted the actual concept of implementation...couple of live examples will be highly appreciated. Thanks