[thelist] exiting out of a function using a nested function

James Aylard evolt at pixelwright.com
Tue Jul 2 16:49:01 CDT 2002


Tom,

> I have a page where some data is being loaded. If that data is not
> loaded, I have to stop execution of a function, but I cannot figure
> out how to exit out...let me show ya (easier than explaining)

    Modifying your original script:

function init()
{
  if (!checkData()) // checking to see if the data is present
  {
    return false ; // will end only if checkData() is false
  }
  // otherwise, it will continue on with the other stuff...
}

function checkData()
{
  if (the data is not there)
  {
    // hey, you have no data!
    return false ;
  }
  return true ;
}

James Aylard




More information about the thelist mailing list