Concept Flow - When clause in catch
Try block starts
Exception thrown?
No→Try block ends normally
Yes
Catch block with when clause
Evaluate when condition
Condition true?
No→Skip this catch
Next catch or unhandled
Execute catch block
Continue after try-catch
When an exception occurs, the catch block with a when clause checks the condition; if true, it runs, else it skips to the next catch.