<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JXX-Commands: "Jump If ..." |
MiniRobotLanguage (MRL)
JIS. Conditional Jump
Jump If String
Intention
This command can be used to test a string-variable against another string. Or it can be used to check if a string is empty or not. The easiest usage is like this:
JIS.$$TXT|Label
In this Mode, JIS. will jump to the Label, if the given string will evaluate to anything else the nothing (String-Len>0).
In Mode 2, you can compare string lexically. It looks like this:
' Test if the two Strings are equal
JIS.$$TXA=$$TXB|Label
' Test if the two Strings are unequal
JIS.$$TXA!$$TXB|Label
' Test if String P1 is lexically before String P3
JIS.$$TXA>$$TXB|Label
' Test if String P3 is lexically before String P1
JIS.$$TXA<$$TXB|Label
In this Mode P1 and P3 must be variables. These variables will only be resolved once. Specialfolders and Systemvariables will not be evaluated. This way the command is able to work also on binary data.
P2 must be any of the following 4 Operators.
>,<,=,!
When using the > or the < Operator, internally the strings are compared lexically.
For example, when using > , If the string in P1 comes lexically before the string in P3 then the evaluation will be true and the jump is been made.
Using < , If the string in P3 comes lexically before the string in P1 then the evaluation will be true and the jump is been made.
JIS. can be used as a conditional JSR. (Gosub like) if using ":" as a prefix to the Label). In normal Mode JIS. will always just make a JMP. (Goto like).
JNS. generally evaluates to the opposite of JIS.
Hint: If you think that the evaluation is not correct, use
PRT.$$VAR|h
MBX.!
to check for invisible characters and Spaces. You will get a ASC-Dump like this, which shows all characters inside the variable with their Hex-ASC-Code.:
Syntax
JIS.P1|Label
JIS.P1|:Label
JIS.P1P2P3|Label
JIS.P1P2P3|:Label
JIS.P1|P2|P3|Label
JIS.P1|P2|P3|:Label
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.
Example
'*************************************
' Simple JIS - Example
'*************************************
: $$TXT=
' test if String is empty or not
JIS.$$TXT|Label
END.
:Label
MBX.String is not empty
ENR.
'*************************************
' Check if a variable is "empty"
'*************************************
: $$TXA=
JIS.$$TXA=|Label
END.
:Label
MBX.!
ENR.
Remarks
The available condition signs are: >,<,=,!
Use only one of these condition signs.
You can not combine condition signs like ">=" or "<>" etc.
Limitations:
-
See also:
• JME. - Jump on More or Equal
• JLE. - Jump on Less or Equal
• JSR. - Jump SubRoutine (Label)