what is the difference between function and subroutine
....here every one knows theoretically...here my QUESTION IS
WHAT IS THE MEANING OF FUNCTION CAN RETURN A VALUE AND SUB
CAN NOT RETURN A VALUE .....WHAT DOE'S IT MEAN FUNCTION CAN
RETURN A VALUE HOW FUNCTION CAN AND SUB CAN'T ....GIVE A
EXAMPLE FOR BOTH ....HOW IT CAN AND CAN NOT...HELP ANDY ONE....



what is the difference between function and subroutine ....here every one knows theoretically...her..

Answer / denis parker

Function - can return value (but not must) to the calling script

Function with argument and not return value
x = "10"
y = "12"
Call Addition_1(x, y)
Function Addition_1(x, y)
msgbox (x&y)
End Function

Function without argument and not return value
Call Addition_2()
Function Addition_2()
x = "10"
y = "12"
msgbox (x&y)
End Function

Function with argument and return value
x = "10"
y = "12"
z = Addition_1(x, y)
Msgbox z
Function Addition_1(x, y)
Addition_1 = (x&y)
End Function

Function without argument and return value
z = Addition_1()
Msgbox z
Function Addition_1()
x = "10"
y = "12"
Addition_1 = (x&y)
End Function


Subroutine - cannot return value to the calling script

Subroutine with argument and not return value
x = "10"
y = "12"
Call Addition_1(x, y)
Sub Addition_1(x, y)
msgbox (x&y)
End Sub

Subroutine without argument and not return value
Call Addition_2()
Sub Addition_2()
x = "10"
y = "12"
msgbox (x&y)
End Sub

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More QTP Interview Questions

How we can import data from database?

0 Answers  


How to add a standard checkpoint in your test ?

1 Answers  


Explain about the test fusion report of quicktest professional?

0 Answers  


I have application it is one digital clock with all minutes and seconds. you have to identify the time to verify weather the time displayed is correct time or not? How do you automate this scenario?

2 Answers   TCS,


How will internal and external links be validated and updated? how often?

0 Answers  






what is selective recording ? and normal recording?

1 Answers   iSoft,


suppose i give valid user id and password to open an web base application on qtp.how qtp will know itis a valid user id and password

3 Answers  


What are the different types of Database checkpoints in QTP? when they are used?

2 Answers  


We have 10 rows of records in data table, but we have to run 4th, 5th and 6th rows only. How can we handle this scenario in QTP?

5 Answers   Accenture, Banca Sella, Polaris,


How to create frame work for qtp?

1 Answers   Bank Of America, Polaris,


How to test fly out menu in qtp?

0 Answers  


can u tell me the the cost of automation tool QTP ?

7 Answers   Ducont, Sonata,


Categories