The finally block can be useful for cleaning up. You can use try and finally together: : finally « Statement « Flash / Flex / ActionScript






The finally block can be useful for cleaning up. You can use try and finally together:

 
/*
try {
  // Code to try.
}
finally {
  // Code to run regardless.
}
//Or, you can use try, catch, and finally:
try {
  // Code to try.
}
catch (erObject:Error) {
  // Code to run if the try code throws an error.
}
finally {
  // Code to run regardless.
}
*/

        








Related examples in the same category

1.The finally Block
2.Throws an exception in a finally block.
3.Control-Flow Changes in try/catch/finally
4.Using return in finally