onCleanup

Cleanup tasks upon function completion

📝 Syntax

  • onCleanup(function_handle)

  • obj = onCleanup(function_handle)

📥 Input argument

  • function_handle - a function handle to execute upon cleanup.

📤 Output argument

  • obj - an onCleanup object that executes the specified function handle upon cleanup.

📄 Description

onCleanup creates an object that executes a specified function handle when the object is cleared or goes out of scope, allowing for cleanup tasks to be performed automatically upon function completion.

cancel(obj) or obj.cancel() prevents the cleanup function from being executed.

💡 Examples

🕔 History

Version
📄 Description

1.16.0

initial version

Last updated

Was this helpful?