Question

What is the main reason to use a try-catch block in programming?

A To define a new function.
B To handle expected errors or exceptional situations gracefully without crashing the program.
C To create a loop that executes a fixed number of times.
D To declare global variables.
E To optimize code performance.
Practice Next

Hey! Ask a query