Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Lists get sublist

Block returns sublist (slice) of list variable.

This block returns a sublist (slice) of a list variable.

First argument is a variable containing list, second and third argument should be either Int or None. The default argument is None and means a skipped slicing option (i.e. setting pulldown to “first” or “last”).

In case slicing can’t be performed, because the slicing index is for example a string, None is returned.

Block XML representation

XML representation of lists_get_sublist block

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="lists_get_sublist">
    <mutation at1="true" at2="true"/>
    <field name="WHERE1">FROM_START</field>
    <field name="WHERE2">FROM_END</field>
    <value name="VALUE">
      <block type="variables_get">
        <field name="VAR">list</field>
      </block>
    </value>
    <value name="AT1">
      <block type="math_number">
        <field name="NUM">0</field>
      </block>
    </value>
    <value name="AT2">
      <block type="math_number">
        <field name="NUM">0</field>
      </block>
    </value>
  </block>
  <block type="lists_get_sublist">
    <mutation at1="false" at2="false"/>
    <field name="WHERE1">FIRST</field>
    <field name="WHERE2">LAST</field>
    <value name="VALUE">
      <block type="variables_get">
        <field name="VAR">list</field>
      </block>
    </value>
  </block>
</xml>

Example of visual representation

Block "In list get sub-list from"

Block “In list get sub-list from”