|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > LST. - List Arrays > Queue-Operations > Smart Package Robot 's Queue Commands |
MiniRobotLanguage (MRL)
LST.QuePop
Pop the First Value from the Queue
Intention
The LST.QuePop command is used to remove and retrieve the first value from the queue in a specified list container. This is a fundamental operation for managing data in a First-In-First-Out (FIFO) manner, where the first value added to the queue is the first one to be retrieved.
The queue is a data structure that allows you to store and retrieve values in a specific order. The LST.QuePop command removes the first value from the queue and optionally stores it in a variable.
Syntax
LST.QuePop|P1|P2
Parameter Explanation
P1 - The handle of the list container. This is a numeric value or a variable that contains the handle of the list.
P2 - (Optional) The variable to store the popped value. If omitted, the value is placed on the Top of Stack (TOS).
Example
'***********************************
' LST.QuePop Sample Script
'***********************************
' Create a new list container
LST.New|$$LST
' Add values to the queue
LST.QuePush|$$LST|10
LST.QuePush|$$LST|20
LST.QuePush|$$LST|30
' Pop the first value
LST.QuePop|$$LST|$$VAL1
' Display the popped value
DBP.$$VAL1
' Pop the next value
LST.QuePop|$$LST|$$VAL2
' Display the popped value
DBP.$$VAL2
' End the script
ENR.
Remarks
-
Limitations:
- If the queue is empty, the command will return an error or an empty value.
See also:
• LST.QuePush - Add a Value to the End of the Queue
• LST.QuePeek - Peek at the First Value in the Queue
• LST.New - Create a New List Container
• LST.End - End a List Container