Creator Help

List - Sublist

Table of Contentsup

Overview

The Sublist Deluge list syntax returns a set of elements from any given list based on the specified start and end indexes. The returned sublist will contain all the elements within the specified start and end indexes(inclusive of start index and end index elements). While the start index is mandatory, the end index is optional. If no end index is specified, the last element in the list is considered as the end index.

Syntax

<list>.sublist(<startIndex>, <endIndex>);

where,

<list> - (Mandatory) refers to the list name which has to be sorted.
<startIndex> - (Mandatory) refers to the position of the first element of the sublist you want to retrieve.
<endIndex> - (Optional) refers to the position of the last element of the sublist you want to retrieve. 

Note:

  • If no end index is specified, the last element in the list is considered as the end index.
  • Index starts with "0"

Examples

colors = {"red", "blue", "green", "yellow"};
x = colors.sublist(1, 3); // returns the colors "blue", "green" and "yellow"
y = colors.sublist(2);     // returns the colors "green" and "yellow"

Top