in what situation does a function return a value
Answers
Answer:
FUNCTION THAT RETURN VALUE
A return is a value that a function returns to the calling script or function when it completes its task. A return value can be any one of the four variable types: handle, integer, object, or string. The type of value your function returns depends largely on the task it performs.
You use the Function Returns edit combo box in the General page of the New Script dialog to tell JAWS the type of value the function returns. You also type the description of the return in the Return description edit box. Adding a description for the return, helps you and anyone else using your function to determine exactly what the value should be used for within the calling script or function.
When you create a new function that returns a string value, the Script Manager places the following function beginning line into your script file:
String Function MyFunction ()
The "string" key word that precedes the "function" key word tells you that the MyFunction function returns a string value to the calling script or user-defined function.
The Return Statement
You use the return statement to send a value back to the calling script or user-defined function. This key word tells JAWS to return the specified value to the calling script or function. You can return the value as a literal value or within a variable. The syntax of a return statement that sends a string value stored in a variable called sText back to the calling script or user-defined function follows:
Return sText
A return statement that returns a string of text, "This is a string", as a literal follows:
Return "this is a string"
When a function returns a value to the calling script or user-defined function, you must store that value in either a local or global variable. You can then use that variable to make decisions on what the calling script or user-defined function should do next.