|
<< 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.QuePeek
Peek at the First Value in the Queue
Intention
The LST.QuePeek command allows you to view the first value in the queue without removing it. This is useful for inspecting the value at the front of the queue without altering the queue's contents.
The queue operates on a First-In-First-Out (FIFO) principle, meaning the first value added to the queue is the first one to be retrieved. The LST.QuePeek command provides a way to inspect this value without modifying the queue.
Syntax
LST.QuePeek|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 - The variable to store the first value in the queue. If omitted, the value is placed on the Top of Stack (TOS).
Example
'***********************************
' LST.QuePeek 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
' Peek at the first value
LST.QuePeek|$$LST|$$VAL
' Display the peeked value
DBP.$$VAL
' 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.QuePop - Pop a Value from the Queue
• LST.New - Create a New List Container
• LST.End - End a List Container