[thelist] JS: Exiting a Function

.jeff jeff at members.evolt.org
Sun Feb 2 14:54:01 CST 2003


syed,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Syed Zeeshan Haider
>
> In fact, I would not have asked this if I had not been
> learning VB. In VB, "Exit Sub" is used to exit a
> procedure when no more execution is needed. Today
> while amending my own written script I found that if I
> had something like "Exit Sub" in JS, my script would
> have been a lot simpler.  I want to exit the function
> when a certain condition has been satisfied.
>
> [snip]
>
> Is there anything in JS like "Exit Sub" of VB for
> above-mentioned situations.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

yes, the return statement.

function myFunction()
{
  return;  // we're done, let's stop execution
}

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list