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

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  


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

0 Answers  


Someone who protect my excel file, m using ms office 2007 and windows 7 operating system, pls help me, how can i unprotect sheet

0 Answers  


We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?

0 Answers   Nous,


Why we use Action Script(Multimedia Flash) rather than using other scripting languages (JAVA,VB...etc) ?

0 Answers   Wipro,






why script is client dependant.

0 Answers  


What are the advantages and disadvantages of Descriptive programing and Object repository in QTP??

1 Answers   Impetus,


can I name the build.xml with any name? if so how can I invoke ?

0 Answers  


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

0 Answers  


a="10.20.30.1" replace 1 with 45 in python using reg ex

0 Answers   HCL,


How can you convert QTP 8.2 scripts to QTP 9.2. Please give some inputs ASAP.

0 Answers   MagnaQuest,


In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?

1 Answers   Nous,


Categories