DEV Community

Discussion on: The fight between Try-Catch and If-Else

Collapse
 
rolfstreefkerk profile image
Rolf Streefkerk

They're functionally not even the same thing.
A try catch block is used to capture exceptions happening within that block.

If else is a control statement block, meaning, a certain variable has a certain state and you control the program flow based on that.