Smart Package Robot 's Stack Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > LST. - List Arrays > Stack-Operations >

 Smart Package Robot 's Stack Commands

LST.StkPeek - Peek at the Top Value on the Stack

Previous Top Next


MiniRobotLanguage (MRL)

 

LST.StkPeek

Peek at the Top Value on the Stack

 

 

Intention

 

The LST.StkPeek command allows you to view the top value on the stack without removing it. This is useful for inspecting the value at the top of the stack without altering the stack's contents.

The stack operates on a Last-In-First-Out (LIFO) principle, meaning the last value pushed onto the stack is the first one to be retrieved. The LST.StkPeek command provides a way to inspect this value without modifying the stack.

 

 

Syntax

 

LST.StkPeek|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 top value. If omitted, the value is placed on the Top of Stack (TOS).

 

 

Example

 

'***********************************

' LST.StkPeek Sample Script

'***********************************

' Create a new list container

LST.New|$$LST

' Push values onto the stack

LST.StkPush|$$LST|10

LST.StkPush|$$LST|20

' Peek at the top value

LST.StkPeek|$$LST|$$VAL

' Display the peeked value

DBP.$$VAL

' End the script

ENR.

 

 

Remarks

 

-

 

 

Limitations:

- If the stack is empty, the command will return an error or an empty value.

 

See also:

 

LST.StkPush - Push a Value onto the Stack

LST.StkPop - Pop a Value from the Stack