You could also use an exception to perform an immediate exit. Something like this (untested) :-
Type MyFatalException Field errorCode EndType Try ' main program stuff goes here ' if there's an error throw an exception with the return code in it like so :- ' If someErrorOccurred except:MyFatalException = New MyFatalException except.errorCode = 2 Throw except EndIf Catch e:MyFatalException Return e.errorCode End Try ' We got to the end safely Return 0