Is the “when” keyword in a try catch block the same as an if statement?
In addition to the several fine answers you already have here: there is a very important difference between an exception filter and an “if” in a catch block: filters run before inner finally blocks. Consider the following: void M1() { try { N(); } catch (MyException) { if (F()) C(); } } void M2() { … Read more