I have a function which looks like this:
function myFunc(){
if (!condition1){
//some extra code (diff. from condition2 if-statement)
doSomething();
return;
}
if (!condition2){
//some extra code (diff. from condition1 if-statement)
doSomething();
return;
}
//some extra code (diff. from both condition if-statement)
doSomething();
}
I would like to know if there is a way to simplify this code so the function doSomething()
always execute (like in Java with try/catch/finally).
Using
try/catch[optional]/finally
solved my problem.