Intermediate R
Q74 / 100

What is the purpose of "on.exit()" inside a function?

Correct! Well done.

Incorrect.

The correct answer is B) To register an expression to be executed when the function exits, regardless of how it exits (normally or via error)

B

Correct Answer

To register an expression to be executed when the function exits, regardless of how it exits (normally or via error)

Explanation

on.exit() schedules code (such as cleanup actions) to run when the enclosing function returns, whether normally or due to an error.

Progress
74/100