Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This function is used for getting the value of an item at a specific index in a list.(Where list items are based on zero-indexed.)

Here's a general explanation of how you can retrieve the value of an item in a list.

Example:

Code Block
languagexml
<O N="getlistitemObject1" T="Project" Category="Functions" TransAlignRule="1">
    <!-- created by ParamML Examples on 8/9/2023 -->
    <P N="List1" V="[[1,2],[10,5],[4,8],[2,1]]" />
    <P N="item_3_0_Value1" V="getlistitem(List1,3,0)" />
    <P N="item_3_0_Value2" V="List1[3][0]" />
</O>
Image Added

As illustrated in the provided image, "List1" represents a collection composed of lists containing numerical elements.
There are two distinct methods for extracting the value of the initial number within the list situated at the fourth index of "List1."
The first approach involves utilizing the function getlistitem(List1, 3, 0), where the parameters correspond to the target list ("List1"), the desired list index (3), and the item index within that inner list (0). Alternatively, the second method employs direct indexing with List1[3][0]. Regardless of the chosen method, both pathways yield the same result, returning the value of 2, which is the first element within the specified list.

To view this example in the library, see (https://openbrim.org/app/?incubator=1&author=ParamML_Examples_OpenBrIM+Platform&obj=objid5g4147u1adp1hh1i3aiv )