<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JXX-Commands: "Jump If ..." |
MiniRobotLanguage (MRL)
JME. Conditional Jump
Jump on More or Equal
Intention
This command can be used to test a Variable for being "more or eqal" against another variable or value. Here is a simple example that also uses the "post-decrement" option to easily construct a loop.
' Start-value
VAR.§§NUM=10
'-------------------------
:lop
DBP.§§NUM
' We're using the post-decrement operator as P2
JME.§§NUM<1|lop
'-------------------------
END.
If you switch variables P1 and P2 you can test for "smaller then".
The command can be switched from default mode (Jump Mode) into "Gosub Mode" if you prefix the Label-Parameter P3 with a colon. Here is an example:
JME. is somehow the counterpart to JLE. - Jump on Less or Equal .
Syntax
JME.P1P2P3|P4
Parameter Explanation
P1 - must be variable
P2 - can be an
> increment-operator
< decrement operator or
| (Pipe Symbol) if no change of the value should happen
P3 - variable or formula* in (..) or numeric value
P4 - Label or Variable that evaluates to a Label.
If it starts with a ":" (colon) a JSR. - Jump SubRoutine (Label) (GOSUB like)
Jump is done instead of the normal JMP. - Jump to Label (GOTO like) Jump..
*In case of JME. the formula must never contain any of the possible Sign-Operator (P2) or else the command may not be properly interpreted.
Example
'*************************************
' Simple JME - Example
' 1 is the Loop-End
' the < makes a post-decrement
'*************************************
' Start-value
VAR.§§NUM=10
'-------------------------
:lop
PRT.§§NUM
JME.§§NUM<1|lop
'-------------------------
END.
'*************************************
' Another JME - Loop-Example
' using variables
'*************************************
' Start-value
: §§NUM=10
: §§TAR=5
: §§LAB=lop
:lop
PRT.§§NUM
' 5 is the Loop-End
VDC.§§NUM|2
JME.§§NUM|§§TAR|§§LAB
MBX.!
END.
Remarks
-
Limitations:
-
See also:
• JME. - Jump on More or Equal
• JLE. - Jump on Less or Equal
• JSR. - Jump SubRoutine (Label)