<< Click to Display Table of Contents >> Navigation: 3. Script Language > FEX. - Enumerations > Enumerations Commands (FEX) |
MiniRobotLanguage (MRL)
FEM. Enumeration Command
For each Member (string between delimiter)
Intention
Enumerate parts of a string. They must be delimited with a blank or other specified character.
Syntax
FEM.P1|P2|P3[|P4][|P5]
Parameter Explanation
P1 - Label where the for each will jump "for each element"
P2 - Temp. Variable, updated by FEX each round.
P3 - (variable) source string that will be enumerated
P4 - (optional) delimiter between the parts of P3,
if omitted Space (ASCI 32) is used.
P5 - (optional) optional Standard Pattern
Example
'**********************************************
' Simple FEM.
'**********************************************
: $$TAR=Hallo Peter das ist ein Satz.
FEM.:Tar|$$VAR|$$TAR|$sp$
DMP.
:over
MBX.Halt to read output
END.
:Tar
PRT.$$VAR
RET.
'**********************************************
' Nested FEM.
' FEM./FEX can be nested to unlimited
' Depth.
'**********************************************
'DBM.2
: $$TAR=H!a!l!l!o P!e!t!er d!a!s i!s!t e!i!n S!a!t!z.
' We did not write the delimiter then $sp$ is used.
FEM.:Tar|$$VAR|$$TAR
DMP.
:over
MBX.Halt to read output
END.
:Tar
PRT.$$VAR
FEM.:Tab|$$BAR|$$VAR|!
RET.
:Tab
PRT.$$BAR
RET.
'**********************************************
' EFX-Sample
'**********************************************
DBM.2
: $$PAT=Ralf Rolf Peter Franz Jacob
: $$TAR=Monika Sabine Pauline June Sabine
FEM.:Lev1|$$VAR|$$TAR
DMP.
MBX.Ready
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
FEM. is a Member of the FEX-Family "For Each X". They are used for easy enumeration
Limitations:
-
See also:
• 3.1 Systemvariables especially: #fex#, #fxd# . etc.
• FEV. - For-Each-Variable(-Line)