Stack Operations

<< Click to Display Table of Contents >>

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

Stack Operations

STK.InvRotate

Previous Top Next


MiniRobotLanguage (MRL)

 

STK.InvRotate

Inversely rotate the top elements on the stack

 

 

Intention

 

The STK.InvRotate command is used to perform an inverse rotation of the top $$ANZ elements on the stack. An inverse rotation moves the bottommost item of the top $$ANZ elements to the top, causing all other elements to shift down by one position.

If $$ANZ is 0, the command rotates all elements in the stack.

 

 

 

Syntax

 

 

STK.InvRotate|P1[|P2]

 

 

Parameter Explanation

 

P1 - The stack handle. This is typically a variable that contains the handle of the stack.

P2 - (Optional) The number of elements to rotate. If omitted or set to 0, all elements in the stack are rotated.

 

 

Example

 

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

' STK.InvRotate - Sample Script

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

' Create a new stack

STK.New|$$STK

' Push some values onto the stack

STK.Push|$$STK|First

STK.Push|$$STK|Second

STK.Push|$$STK|Third

' Inversely rotate the top 3 elements

STK.InvRotate|$$STK|3

' Pop and display the values

STK.Pop|$$STK|$$VAL

DBP. Popped value: $$VAL

STK.Pop|$$STK|$$VAL

DBP. Popped value: $$VAL

STK.Pop|$$STK|$$VAL

DBP. Popped value: $$VAL

' End the stack

STK.End|$$STK

ENR.

 

 

Remarks

 

-

 

 

Limitations:

-

 

See also:

 

STK.New - Create a new stack

STK.Rotate - Rotate the top elements on the stack

STK.Push - Push a value onto the stack