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

Can anyone help.i need total excelsheet operations,shortcuts in testing environment from starting onwards....

0 Answers  


Hi to All, My name is Aditya, i have 4 year exp in software testing (Manual Testing), but i try to shift my career now in automation testing. right now i have no exp or u can say i am not hand exp in live application. So please guide me, what i do ???? Can i join again automation course only practical which is live application. if u know any person who's expert in qtp and he/she ready to take my class i have our own and company laptop. If required i will pay amount please don't mind. Please help me, and i am also planing to join core java from coming 1st Aust (in seed) for only purpose the understanding script of Automation (QTP)... Please help me... I am waitting u r replay... Thank you Thanks again

5 Answers  


does qtp need record and playback in realtime. plz tell exactly wat happens

3 Answers   HP,


what is exacltly TIERS ?

0 Answers  


.mtr ( modular test repository or mercury test repository) plz give correct answer??

3 Answers  






Hi any body pls help me for QTP 11.0 software free demo version. i have to practice. Kindly send the link.or where i have to download.

0 Answers  


how can i replace any text from the qtp script with some anothere text

1 Answers   Livetek,


What is load testing?

1 Answers   Crea,


what the difference between shared repository and per action repository?

0 Answers  


How to Analyze the Checpoint results by Text/Text Area Checkpoint?

1 Answers  


Hello! i am having two comboboxes.Each having 10 items in it.when i select first item in first combobox,it is not similar in the second combobox.for ex in first combo if it is Hyderabad,in second it should be some chenai or some other item .Write a VBSCRIPT for that?

3 Answers   Tech Mahindra,


How you handles Pop-up windows which are Dynamically changing in Runtime?

2 Answers  


Categories