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.StkPop

Previous Top Next


MiniRobotLanguage (MRL)

 

ARS.StkPop

Pop the top value from the stack.

 

 

Intention

 

The ARS.StkPop command removes and retrieves the top value from the stack. The stack is a Last-In-First-Out (LIFO) data structure, meaning the last element pushed will be the first one to be popped.

 

 

Illustration:

Stack Structure:

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

│ TopValue      │  ← Popped

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

│ SecondValue   │

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

 

Syntax

 

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

 

 

Parameter Explanation

 

P1 - $$ARR The handle of the stack.

P2 - $$VAL (Optional) The variable to store the popped value.

 

 

Example

 

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

' ARS.StkPop - Sample Script

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

' Create a new stack

ARS.New|$$STK

' Push a value onto the stack

ARS.StkPush|$$STK|FirstValue

' Pop the top value

ARS.StkPop|$$STK|$$RES

DBP.The popped 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.StkPeek