|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > LST. - List Arrays > List-Operations > LST. - Management |
MiniRobotLanguage (MRL)
LST.Reverse
Reverse the order of elements in a list.
Intention
The LST.Reverse command reverses the order of elements in a list container.
This is useful when you need to process the list elements in reverse order.
The elements will be reversed in the list.
The original list handle will still be valid and all elements will be in the list as before but in reverse order.
Illustration
Before LST.Reverse operation:
List: [1, 2, 3]
After LST.Reverse operation:
List: [3, 2, 1]
The elements are reversed in the list.
Syntax
LST.Reverse|P1
Parameter Explanation
P1 - (Variable)
The handle of the list to reverse.
Example
'***********************************
' LST.Reverse - Sample 1
'***********************************
LST.New|$$LST
LST.Add|$$LST|1
LST.Add|$$LST|2
LST.Add|$$LST|3
LST.Reverse|$$LST
LST.Pop|$$LST|$$VAL
DBP.Value is $$VAL
LST.Pop|$$LST|$$VAL
DBP.Value is $$VAL
LST.Pop|$$LST|$$VAL
DBP.Value is $$VAL
LST.End|$$LST
ENR.
'***********************************
' LST.Reverse - Sample 2
'***********************************
LST.New|$$LST
LST.Add|$$LST|'A'
LST.Add|$$LST|'B'
LST.Add|$$LST|'C'
LST.Reverse|$$LST
LST.Pop|$$LST|$$VAL
DBP.Value is $$VAL
LST.Pop|$$LST|$$VAL
DBP.Value is $$VAL
LST.Pop|$$LST|$$VAL
DBP.Value is $$VAL
LST.End|$$LST
ENR.
Remarks
-
Limitations:
-
See also:
•