<< Click to Display Table of Contents >> Navigation: 3. Script Language > Variable Definitions and Operations > Variable Commands |
MiniRobotLanguage (MRL)
IVS. Conditional Statement
If Variable String
Intention
Conditional Statement.
Test if a specified string is equal, not equal, or lexically higher or lower then another.
If = or ! are specified as operator, its a simple string-compare if the strings/texts are equal or not.
If > or < are specified as operator, the command will make a lexical compare of the two strings. However if you want to sort items, take a look on the SRT. - Sort Items -command.
Please use IVS. for Strings instead of IVV. - which is only for Values (numeric).
You can use NVS. as the negative Form of the command.
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
IVS.P1(op)P2|P3… ELS. … EIF.
Parameter Explanation
P1 - Variable
(op) - Operator: =,>,<,! (! is NOT)
P2 - Variable
P3 - (optional) can be b - binary or e - equal-case.
e - equalcase.
The compare will be done after all characters have
been converted to ANSI-Lower-case.
b - binary. In this case the Variables are only resolved once,
specialfolders etc. are ignored.
Example
'***********************************
' IVS.-Sample
'***********************************
: §§STA=Alles
: §§STB=Allex
: §§STC=alles
: §§TXT=comes alphabetically first
IVS.§§STA!§§STB
PRT. Strings are not equal!
IVS.§§STA>§§STB
PRT."§§STA" §§TXT
ELS.
PRT."§§STB" §§TXT
EIF.
EIF.
IVS.§§STA=§§STC|e
PRT. In this case we are here.
EIF.
IVS.§§STA=allEs|e
PRT. In this case we are here, too.
EIF.
:over
MBX.!
END.
'**********************************************
' IVS.--Sample 2
' This script will mix anybody with anybody
' unless June and Peter
'**********************************************
'DBM.2
: $$PAT=Ralf Rolf Peter Franz Jacob
: $$TAR=Monika Sabine Pauline June Sabine
FEM.:Lev1|$$VAR|$$TAR
MBX.See Debug-Window in Editor
END.
'-----------------------------------------------------------
:Lev1
'DBP.-Level 1 ($$VAR)
FEM.:Lev2|$$BAR|$$PAT
RET.
'-----------------------------------------------------------
:Lev2
'DBP.--Level 2 ($$BAR)
DBP.Now is $$VAR + $$BAR
IVS.$$VAR=June
IVS.$$BAR=Peter
EFX.
EIF.
EIF.
RET.
Remarks
IVS. and other IXX. can be nested to unlimited Depth, and they can also enclose Sub-Program Calls or FEX. (Enumerations) to unlimited Depth.
Limitations:
-
See also:
• IWS. / NWS. - If Window State
• IVC. / NVC. - If-Variable-Contains
• CAL. - mathematical CALculation
• IVV. / NVV. - If Variable Value