|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > ARS. - Array's > !ARS. - Deque Operations > ARS. - Deque Operations |
MiniRobotLanguage (MRL)
ARS.PushLast
Push a value to the end of the Deque.
Intention
The ARS.PushLast command adds an element to the end of the Deque. This is useful for appending elements to the Deque in a last-in-first-out (LIFO) manner.
Illustration:
Deque Structure:
┌───────────────┐
│ FirstElement │
├───────────────┤
│ SecondElement │
├───────────────┤
│ NewElement │ ← Pushed
└───────────────┘
The new element is added to the end of the Deque.
Syntax
ARS.PushLast|$$ARR|$$VAL
Parameter Explanation
P1 - $$ARR The handle of the Deque.
P2 - $$VAL The value to be added to the end of the Deque.
Example
'***********************************
' ARS.PushLast - Sample Script
'***********************************
' Create a new Deque
ARS.New|$$DEQ
' Push elements onto the Deque
ARS.PushLast|$$DEQ|FirstElement
ARS.PushLast|$$DEQ|SecondElement
' Peek at the last element
ARS.PeekLast|$$DEQ|$$RES
DBP.The last element is: $$RES
' End the script
ENR.
Remarks
-
Limitations:
- The Deque must have sufficient capacity to add the new element.
See also:
• ARS.New