TERMINATE PROGRAM IN STRUCTORIZER CODE
An integer value is expected to be appended as exit code (by default 0 would be passed), e.g. Program exit: The keyword exit allows you immediately to terminate the entire program, even from within a subroutine.So if the routine is to provide a result then just write an expression describing the result value or its computation after the keyword return, e.g. This can also be used to return a result value. Routine exit: To leave a routine (the current diagram) immediately, write.Remark: leave 1 is equivalent to leave or an empty Jump element. ( n being a positive integer) within the Jump element will exit from the innermost n loops, such that execution continues with the next instruction after the outer one of the left loops. (This form is roughly equivalent to the break statement in languages like C, Java etc.) If the Jump element is contained by several nested loops, then an instruction
![terminate program in structorizer terminate program in structorizer](https://bythewavs.com/wp-content/uploads/2016/06/luisao-terminate-program.jpg)
Will just prematurely leave the closest surrounding loop, no matter of what kind. Loop exit: an empty Jump element or a Jump element containing simply the keyword.The following types of "jumps" are supported both on execution and code export: You are not encouraged to use Jump elements, however. This use of an EXIT element is possibly the most justifiable one.
![terminate program in structorizer terminate program in structorizer](https://www.heise.de/download/media/structorizer-57868/strucorizer1_1-1-30.png)
If the thrown problem can be solved on a higher level then the execution may be continued on that level, otherwise the program will abort (as if we had used an exit command). It is used to leave the current algorithmic context in case of a detected problem (an exception) that can not be solved on the current level but might be handled by some higher context with a more general perspective if we pass the necessary information there. Version 3.29-07/-08 introduced a fourth flavour of Jump element: The throw instruction (aka raise instruction). It can always be avoided (see example below), but may sometimes be a pragmatic and convenient way to formulate algorithms that otherwise would require some complicated workaround with logical variables, additional conditions etc. It is not actually a means of structured programming, it rather contradicts the ideas of this concept. The Jump (or EXIT) element indicates some kind of explicit exit from a loop, a routine, or the program.