ARS. - Stack Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > ARS. - Array's > !ARS. - Stack Operations >

ARS. - Stack Operations

ARS.StkPeek

Previous Top Next


MiniRobotLanguage (MRL)

 

ARS.StkPeek

Peek at the top value on the stack without removing it.

 

 

Intention

 

The ARS.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 its contents.

 

 

Illustration:

Stack Structure:

┌───────────────┐

│ TopValue      │  ← Peeked

├───────────────┤

│ SecondValue   │

└───────────────┘

 

Syntax

 

ARS.StkPeek|$$ARR[|$$VAL]

 

 

Parameter Explanation

 

P1 - $$ARR The handle of the stack.

P2 - $$VAL (Optional) The variable to store the top value of the stack.

 

 

Example

 

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

' ARS.StkPeek - Sample Script

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

' Create a new stack

ARS.New|$$STK

' Push a value onto the stack

ARS.StkPush|$$STK|FirstValue

' Peek at the top value

ARS.StkPeek|$$STK|$$RES

DBP.The top value is: $$RES

' End the script

ENR.

 

 

Remarks

 

-

 

 

Limitations:

- The stack must not be empty when using this command.

 

See also:

 

ARS.New

ARS.StkPush

ARS.StkPop