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
How to test fly out menu in qtp?
Can any body please tell me the steps of keyword driven framework of QTP.
How to sendKeys in QTP? Diff b/w sendkeys and device replay? Diff b/w function and Sub? Diff b/w Array and List Different Types of running Keys other than Fast, slow,Normal mode Regular expression for http://newtours.demoaut.com Difference between \w and \W How to generate script button Recording Types Different Types of Actions? Using DP performance degrades, If Yes why? How to close all the opened browsers? Diff b/w SystemUtil.Run and invoke application? If qtp not recognized the combo box How to select values from drop down?
How QTP identify the system time that's changes every seconds?
how to compare two bitmaps( 1. clients requirement & 2. Designed by dev) in qtp 8.2 wann clear steps
1. What is the difference between Keyword and function in the keyword driven framework? 2. How do you associate Keywords to the script ?
Brief the process of testing with UFT?
What is Cross browser testing? Does UFT support it?
What is the default object synchronization timeout in qtp?
I am in .Net development for past 3.5 years and want to enter in to automated testing and learn QTP. For this I need some good tutorial for beginners. I will be really greatful if any one has and they can send it to me on this address- ruchidureja@gmail.com
What are the benefits of qtp?
if anyone has idea of the interview procedure in covansys, plz send me a mail?
How do Parameterization and Data-Driving relate to each other in QTP?
What is checkpoints for quicktest professional?
How will you find the current time of the remote machine using QTP script?