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
What is the basic concept of qtp?
what is command for executing files?
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
Does QTP run in any environment?
If an application name changes frequently i.e while recording it has the name, in this case, how do qtp handles?
How many ways is to parameterize the value?
Hi All, How to Compare two strings character by character in QTP
How many test scenarios you have automated? How many time it will take to execute 30-40 scenarios? What SDLC model you are following? How often you will execute your test scripts? Because of some changes, your test scripts failed? When you will update your test scripts? How much time it will take to update? Do you know how to connect database? Do you know the direct method to count no. of records (or) rows present in record set once query is executed? How will you create the connection string? How did you resolve conflicts present in Object Repository? How good you are in VB? How will you work on Excel Application? How will you select Excel sheet? If you want to select 10 sheets, will you create 10 separate objects? Given string is “abcd”. What are the methods you will use to display “dcba”? Drives script – explain the frameworks? How you are updating results for each test? What is start up, configuration, navigation scripts? If you are not able to understand the application (some module), who will teach you? What test cases to be automated? When to be automated? What is the testing process you are following? What life cycle you are following? When you will use Descriptive Programming? Do you have the permission to add objects into shared object repository? (OR) someone will maintain SOR? Do you know how to add objects into shared object repository? How many test cases you have automated? How much time will it take to execute? What is complex in automation? When you feel automation is complex? Tell me one scenario, the complex functionality you have automated in your project? Excel sheet having some datas and some datas present in the application (in table). How will you compare these two datas? Write code to fetch datas from Excel sheet. Rate yourself in SQL? Display the employee name who is getting maximum salary? sal ID Salary name 001 100 002 500 003 300 ID 001 002 003 Ename A B C Have you written any test cases while you are in Automation? Manual Testing also will you do or you will work only in automation?
I want to write some certification courses, so friends could you guide me? which certification is best and how to write exam and what tutorials need to be studied,what to do first, I am working on automation tool QTP 9.2
.have you ever written compiled module? if yes , tell me about some of the function that you wrote.
can any body give the banking domain concepts/links
we use a file extension .properties why is it used and where do we use it plz help me out with detailed explanation and navigation of how to use on the QTP 8.2?
Why do we use breakpoints in QTP?
whow much strong on VB and C?
What is the difference in the global and action sheet in qtp?