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

Hi friends I need to know about jubula automation tool. Is anybody know in bangalore where jubula tanning class is going on do let me know. Its urgent for me to learn that tool please help.

0 Answers  


when i am running login page i got test run error? Please give me the script to handle run time exceptions. It's urgent for me.

4 Answers  


Why is action split used by qtp?

0 Answers  


Tell me the situations where we will use Data Driven?

2 Answers  


How to use output values in qtp ?

0 Answers  






what is run action?

0 Answers  


When I start recording any web application (either Mozilla or IE) QTP recognizes window instead of browser and also it does not show all the hierarchy tree of that particular web page. 1. Window("Mozilla Firefox").Check CheckPoint("Mozilla Firefox") 2. As everybody knows it should be browser("Mozilla Firefox").Check CheckPoint("Mozilla Firefox") I am using the windows vista, do you think it may be a problem of my settings in QTP or problem of my installation. Your kind responses will be appreciated. Thanks in advance. Satya

12 Answers  


How to upload excel files into Quality Center using QTP Script and how to delete excel files from Quality?

0 Answers  


IF there are seven browsers with same name open. I want to close one particular browser thru QTP. how can i do this?

3 Answers   Polaris,


Give me some scripts for 1). checking webpage links (counting links,opening web pages,counting child elements)

2 Answers   CIL,


How to handle the errors without using recovery scenery?

3 Answers  


what is the difference between the modular framework and datadriven frame work

2 Answers  


Categories