<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JXX-Commands: "Jump If ..." |
MiniRobotLanguage (MRL)
JLE. Conditional Jump
Jump on Less or Equal
Intention
This command can be used to test a Variable for being "less or eqal" against another variable, formula or value.
Additionally the Command allows a "post-decrement" or alternatively a "post-increment" for easy Loop-Constructions. "Post-increment" will increment the given variable after the test inside the variable was done. This can be used to construct simple Loops.
Here is an example with "Post-increment":
' Start-value
: §§NUM=1
: §§TAR=5
: §§LAB=lop
:lop
PRT.§§NUM
' 5 is the Loop-End
JLE.§§NUM>§§TAR|§§LAB
DMP.
MBX.!
END.
If you switch variables P1 and P2 you can test for "bigger 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:
JLE. is the counterpart to JME. - Jump on More or Equal.
Syntax
JLE.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 JLE. the formula must never contain any of the possible Sign-Operator (P2) or else the command may not be properly interpreted.
Example
'*************************************
' Simple JLE - Example
'*************************************
' Start-value
VAR.§§NUM=1
:lop
PRT.§§NUM
' 5 is the Loop-End
' > makes an post-increment to §§NUM
JLE.§§NUM>5|lop
DMP.
MBX.!
END.
'*************************************
' Another JLE - Loop-Example
' using variables
'*************************************
' Start-value
: §§NUM=1
: §§TAR=5
: §§LAB=lop
:lop
PRT.§§NUM
' 5 is the Loop-End
JLE.§§NUM>§§TAR|§§LAB
DMP.
MBX.!
END.
'*************************************
' Another JLE - Loop-Example
' using variables and a formula
'*************************************
' Start-value
: §§NUM=1
: §§TAR=5
: §§LAB=lop
:lop
PRT.§§NUM
' 5 is the Loop-End
JLE.§§NUM>(§§TAR+1)|§§LAB
DMP.
MBX.!
END.
Remarks
-
Limitations:
-
See also:
• JME. - Jump on More or Equal
• JLE. - Jump on Less or Equal
• JSR. - Jump SubRoutine (Label)