How can we return a value from User Defined Function ? For
Eg. we have 2 functions. In Fun1 i am getting 2 values (a,b)
and i am addding those 2 and storing in to another var (c).
Now i want to pass that var(c) to another function (fun2).
What will be the script?

Answers were Sorted based on User's Feedback



How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / krishna chand

Hi Ganesh,

I will try for this. Thank u for sending responce once
again.

Is This Answer Correct ?    1 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ganesh

<script language="javascript">
function add()
{
var a=parseInt(document.getElementById('x').value);
var b=parseInt(document.getElementById('y').value);
var c= a + b;
fun(c);
}
function fun(disp)
{
alert(disp);
}
</script>
</head>
<body>
Enter First Number:<input type="text" id="x" /><br />
Enter Second Number:<input type="text" id="y" /><br />
<input type="button" value="Add" onclick="add()" />
</body>



Am i right ??

Is This Answer Correct ?    1 Yes 1 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / krishna chand

I don't think so Ganesh because, The same i said in the
interview, then the Interviewr said it is wrong we can not
decalre the function directly like function fun(disp).

Is This Answer Correct ?    0 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ganesh

Hi Mr. Krishna,
I worked on this code.
its working right ??

Is This Answer Correct ?    0 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ganesh

k.
try & bck to me !!!

Is This Answer Correct ?    0 Yes 0 No

How can we return a value from User Defined Function ? For Eg. we have 2 functions. In Fun1 i am ge..

Answer / ramesh

Hi Ganesh/Krishna,

Can you try it out the below one.


function add(out c)
{
c=a+b
add(c)
}

dis=add(c)
function len(dis)
{
count=length(dis)
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Scripts AllOther Interview Questions

I have installed QTP version 9.0. I have installed Mozilla firefox version 2.0. But QTP "Record and Run settings" in WEB tab shows FIREFOX 1.5 in drop down to run session begins. So QTP does not record anything which I type in firefox. How can i recognise firefox 2.0 and how can i update browser version in QTP?

0 Answers  


In sap script, created 1 form but when its went to production system , client want some changes in 1 (ex - addrss) window, what we will do?

0 Answers  


What is a Scripting Language?

2 Answers  


I Am Planning to Write ISTQB foundation level Ceritification of inida. can Any Body let me know how to prepare for it & Any Study material can you provide or Any other E-books i should need to Study. Please Mail to me ajaybe_2004@yahoo.co.in THnaks in advance Ajay

0 Answers  


what is Eventflow.?

1 Answers  






how can we move to the next column in excel sheet in file operation using descriptive programming inQTP?

0 Answers   HP,


QTP not able to select multiple row selection when new rows are added

0 Answers  


how do invoke OS task through ANT?

0 Answers  


Difference between the SAP MDM vs IBM MDM in approach, the tools used , ease in handling/implementing.

0 Answers   Wipro,


what is the fullform of URL or URI?

4 Answers   HCL, ICICI,


How to Communicate with JavaScript?

1 Answers  


Need a batch file or VB script to delete old (more than 90datys) roaming profiles

0 Answers  


Categories