Smart Package Robot 's List Commands

<< Click to Display Table of Contents >>

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

 Smart Package Robot 's List Commands

LST.Last - Get Last Node in List

Previous Top Next


MiniRobotLanguage (MRL)

 

LST.Last - Get Last Node in List

Retrieve the handle to the last node in a list

 

 

Intention

 

The LST.Last command retrieves the handle to the last node in a list. This is useful for iterating through the list in reverse or accessing the last element directly.

If the list is empty, the command will return 0.

 

Syntax

 

LST.Last|P1[|P2]

 

Parameter Explanation

 

P1 - The list handle, typically a numeric value or a variable that contains a valid list handle.

P2 - (Optional) Variable to store the handle of the last node. If omitted, the result is placed on the Top of Stack (TOS).

 

Example

 

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

' LST.Last Sample

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

' Create a new list

LST.New|$$LST

' Add elements to the list

LST.Add|$$LST|Hello

LST.Add|$$LST|World

' Get the last node

LST.Last|$$LST|$$LAST

' Print the result

DBP. Last node handle: $$LAST

' End the list

LST.End|$$LST

 

Remarks

 

-

 

Limitations:

- The list must be initialized using LST.New before using this command.

 

See also:

 

LST.New - Create a New List

LST.First - Get First Node in List

LST.Next - Get Next Node in List

LST.Prev - Get Previous Node in List