Advanced R
Q89 / 100

What is the difference between "tryCatch()" and "try()" for error handling?

Correct! Well done.

Incorrect.

The correct answer is B) try() simply suppresses the error and returns an object of class "try-error", while tryCatch() allows specifying distinct handler functions for different condition classes (error, warning, etc.)

B

Correct Answer

try() simply suppresses the error and returns an object of class "try-error", while tryCatch() allows specifying distinct handler functions for different condition classes (error, warning, etc.)

Explanation

tryCatch() provides structured handling with separate handlers for different condition classes (error, warning, message, etc.), while try() is a simpler wrapper that just catches errors and continues.

Progress
89/100