跳到主要内容

List.First

返回列表的第一个值;如果为空,则返回指定的默认值。

Syntax

List.First(
list as list,
optional defaultValue as any
) as any

Remarks

返回列表 list 中的第一个项;如果列表为空,则返回可选的默认值 defaultValue。 如果列表为空且未指定默认值,函数将返回 null

Examples

Example #1

查找列表 {1, 2, 3} 中的第一个值。

List.First({1, 2, 3})

Result:

1

Example #2

查找列表 {} 中的第一个值。如果列表为空,则返回 -1。

List.First({}, -1)

Result:

-1

Category

List.Selection