列表 (list)

元素的陣列。請參閱陣列

由以下項目傳回

列表物件由以下函式和方法傳回

列表方法

list.contains()

如果陣列包含作為參數給定的物件,則傳回 true,否則傳回 false

簽名

# Returns `true` if the array contains the object
bool contains(
  any item,     # The item to check
)

參數

此函式不支援參數扁平化

方法 list.contains() 接受以下位置參數

名稱 類型 描述 標籤
item any

要檢查的項目


list.get()

傳回指定索引處的物件,負索引從陣列末尾開始計算,超出範圍的索引會傳回 fallback(自 0.38.0 起),如果未指定,則會導致嚴重錯誤

簽名

# returns the object at the given index,
any get(
  int index,        # Index of the list position to query
  any [fallback],   # Fallback value that is returned if the index is out of range
)

參數

此函式不支援參數扁平化

方法 list.get() 接受以下位置參數

名稱 類型 描述 標籤
index int

要查詢的列表位置的索引。負值從列表末尾開始

fallback any

如果索引超出範圍,則傳回的回退值。

[選填]


list.length()

傳回陣列/列表的目前大小。

簽名

int length()


搜尋結果為