<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JXX-Commands: "Jump If ..." |
MiniRobotLanguage (MRL)
JIV. Conditional Jump
Jump If Variable
Intention
This command can be used to test a Variable for >,<,=,! against another variable or value or formula.
JIV.§§TAA<§§TAB|try
JIV.(§§TAA+5)<(§§TAB+3)|try
JIV. can be used as a conditional JSR. (Gosub like) if using ":" as a prefix to the Label). In normal Mode JIV. will always just make a JMP. (Goto like).
Syntax
JIV.P1P2P3|P4
JIV.P1P2P3|:P4
Parameter Explanation
P1 - variable, formula* in (..) or numeric value
P2 - condition sign: >,<,=,!
Use only one condition sign.
P3 - variable, formula* in (..) or numeric value
P4 - Label or variable that evaluates to a Label. If it contains the ":" a JSR./GSB. is done instead of a JMP.
*In case of JIV. the formula must never contain any of the possible Sign-Operator (P2) or else the command may not be properly interpreted.
Speed in Ticks:
This command uses typically around 250 Ticks.
Example
'*************************************
' Simple JIV - Example
'*************************************
VAR.§§TAA=10
VAR.§§TAB=20
: §§LAB=try
:try
PRT.§§TAA
VIC.§§TAA
JIV.§§TAA<§§TAB|try
PRT.Hier
DMP.
MBX.!
END.
'*************************************
' Advanced JIV - Example (using Formulas)
' as always, formulas must be in ().
'*************************************
VAR.§§TAA=10
VAR.§§TAB=20
: §§LAB=try
:try
PRT.§§TAA
VIC.§§TAA
JIV.(§§TAA+5)<(§§TAB+3)|try
PRT.Hier
DMP.
MBX.!
END.
Remarks
The available condition signs are: >,<,=,!
Use only one of these condition signs.
You can not combine condition signs like ">=" or "<>" etc.
• Instead of >=4 use >3 instead.
• Instead of <> use !
• Instead of <=5 use <6
The result is always the same.
Limitations:
JIV. does not have the Auto-Increment/ Auto-Decrement like for example JIZ.
If you need these, use JME. or JLE. instead.
See also:
• JME. - Jump on More or Equal
• JLE. - Jump on Less or Equal
• JSR. - Jump SubRoutine (Label)