FUNCTION:  Lang.exit

The Lang.exit function is used to perform a normal exit from a WMLScript program. The execution of the WMLScript code is discontinued, control is returned to the caller of the WMLS program, and the information contained in the value parameter is returned to the WMLS interpretor. Simply put, you use this function to exit a WMLS function and return to the calling WML card.
The mandatory value parameter can be a string (including the empty string), an assigned variable, or a string that contains one or more assigned variables and associated text. This parameter is returned to the WMLS interpretor, not to the calling WML card.
In this example, the Lang.random function is used to return a random integer ranging from 0 to 100 in value. A simple if...else test on the value of the random number either returns control to card two or performs an exit which returns control back to card one.
Code for ExitExample.wml
<?xml version="1.0"?>

<card id="card1">
   exit example
   <do type="accept">
      <go href="ExitExample.wmls#exittest( )" />

<card id="card2">
   random number
   <br />


Code for ExitExample.wmls
extern function exittest()
   var result = Lang.random(100);
   if(result < 50)
      WMLBrowser.setVar("randomnum", result);

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