<< Click to Display Table of Contents >> Navigation: 3. Script Language > JXX. - Jump - Instructions > JXX-Commands: "Jump If ..." |
MiniRobotLanguage (MRL)
JNS. Conditional Jump
Jump If No 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:
JNS.$$TXT|Label
In this Mode, JNS. will jump to the Label, if the given string will evaluate to nothing (String-Len=0).
In Mode 2, you can compare strings lexically. It looks like this:
' Test if the two Strings are NOT equal
' If they are equal JNS. will NOT Jump
JNS.$$TXA=$$TXB|Label
' Test if the two Strings are unequal
' If they are unequal JNS. will NOT Jump
JNS.$$TXA!$$TXB|Label
' Test if String P1 is lexically after String P3
JNS.$$TXA>$$TXB|Label
' Test if String P3 is lexically after String P1
JNS.$$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.
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.
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.
JNS. can be used as a conditional JSR. (Gosub like) if using ":" as a prefix to the Label). In normal Mode JNS. will always just make a JMP. (Goto like).
JIS. generally evaluates to the opposite of JNS.
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
JNS.P1|Label
JNS.P1|:Label
JNS.P1P2P3|Label
JNS.P1P2P3|:Label
JNS.P1|P2|P3|Label
JNS.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.
Speed in Ticks:
This command uses typically around 137 Ticks.
Example
'*************************************
' Simple JNS. - Example
'*************************************
: $$TXT=
' test if String is empty or not
JNS.$$TXT|Label
END.
:Label
MBX.String is empty
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)