STATEMENT:  return

The return statement is used inside a function to set the value of the function. This is the value returned by the call of the function. A function can only return one value. If no value is assigned during the function call, then the function has a default value of an empty string "". Therefore, a called function always returns a value, even if it is just an empty string.
Note that once the return is executed, you immediately leave the function and return to where the function call was made from within the code. The function will now have the value that was returned and you can assign that value to a named variable (use the var statement to initialize the variable).
Code for ReturnExample.wml
<?xml version="1.0"?>

<card id="card1">
   return example
   <do type="accept">
      <go href="ReturnExample.wmls#findreturn()" />

<card id="card2">
   return = $(rand)


Code for ReturnExample.wmls
extern function findreturn()
   var ran = findrandom();
   WMLBrowser.setVar("rand", ran);
extern function findrandom()
   return Lang.random(1000);

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information