I'm writing a console application that goes through an algorithm with N number of steps. It is important that step N
is correctly done before step N+1
is executed. Otherwise the program should stop working with an error message.
I can do this with nested if
statements of course and use try-catch-finally
(using a continue flag in finally to decided if the program should process). But I am looking for a better structured design pattern or approach to do this. Any recommendations?