JXX-Commands: "Jump If ..."

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > JXX. - Jump - Instructions >

JXX-Commands: "Jump If ..."

RTS. - ReTurn from Subprogram

Previous Top Next


MiniRobotLanguage (MRL)

 

RTS. Statement

ReTurn from Subprogram to calling script

 

 

Intention

 

Used together with JNF. - Jump New File to call Subprograms.

RTS. will return program flow to the calling Script.

 

If you need to leave a Sub-Program that was called with JNF. to a higher level then just the next, you can add a number behind the RET. Like this:

 

RTS.2

 

If you want to leave to the Top-Level in your script, just write:

 

RTS.all

 

 

 

Syntax

 

 

RTS.[P1]

 

 

Parameter Explanation

 

P1 - Numeric, a variable or the term "all"

 

 

 

 

Example

 

We need to have 2 Script Files for this simple Example. Both need to be in the same folder. The first Scriptfile, "First.txt"  that is run defines ?path, which is the folder where it is. it calls the second file "second.txt".

 

[First.txt]

: §§WHE=In First.txt

: $$GLO=1

PRT. $$WHE, Global=$$GLO

JNF.Second.txt

PRT. $$WHE, Global=$$GLO

END.

 

[Second.txt]

: §§WHE=In Second.txt

: $$GLO=2

PRT. $$WHE, Global=$$GLO

RTS.

 

 

 

Remarks

 

Please do not intermix RTS,. with RET.

RET. is used to Return from Subroutines which are called with JSR./GSB.

 

 

 

Limitations:

 

There are now relevant limitations about recursion depth.

 

 

 

See also:

 

    JNF. - Jump New File

    JMP. - Jump to Label

    RET. - RETurn

    JIV. - Jump-If-Variable

    JIZ. - Jump-If-Zero

  JNZ. - Jump if Not zero

    JOR. - Jump On Repeat-Count

    JME. - Jump on More or Equal

    JLE. - Jump on Less or Equal