By the time I post this story it will be long in the past. I was called in to help another programmer. His code was a semblance of the first set of code. Every time DO X ran with something that did not work, the rest of the program was not run, it failed.
Bad:
SET Z = $1 FOR i in X Y DO X sometimes this works, if it doesn't fail badly END DO DO Y IF Z == TEST1 do something END DO
This was his re-write, better, but not good. Do you see the difference? At least this time everything else in the program is run first, then the program runs the failing code every time, regardless.
SET Z = $1 FOR i in X Y DO Y IF Z == TEST1 do something END DO DO X sometimes this works, if it doesn't fail badly END DO
Under the circumstances the best option. This section that fails will only run if everything has not triggered.
SET Z = $1 FOR i in Y DO Y IF Z == TEST1 do something ELSIF Z == TEST2 do something else ELSE sometimes this works, if it doesn't fail badly END DO
If you recognize the difference in this logic I commend you, my co-worker did not and put it into production. It’s the small logic puzzles that we should enjoy.