其余
Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.
Collects remaining parameters, operands, or extracted fields.
Aliases: rest
Syntax: 其余 <type> <name>
Category#
function
Related#
Examples#
radix/corpus/ceteri/ceteri.fab (canonical · keyword)#
Collects remaining parameters, operands, or extracted fields.
# =============================================================================
# 其余 — Collects remaining parameters, operands, or extracted fields.
# =============================================================================
#
# What this teaches:
# • Rest parameters — `其余 <type> <name>` in a function signature collects
# all remaining arguments into a list
# • Variadic functions — `其余 列表<整数> numeri` enables summing an
# arbitrary number of numeric arguments
#
# Common mistakes:
# • confusing `其余` (rest parameter collecting remaining args into a list) with `空集` (an empty collection initializer)
#
# See also: 函数, 操作数, 取自
# =============================================================================
# 其余 — rest parameter (collects remaining arguments)
#
# 函数 <名称>(其余 <类型> <名称>) → <类型>
#
# GRAMMAR:
# param :← '其余' type ident
#
# EXPECTED OUTPUT:
# none
fn 求和(rest list<int> numeri) → int {
var _ total ← 0
for from numeri const n {
total ← total + n
}
return total
}
main {
# 其余 receives the whole 列表
print 求和([1, 2, 3, 4])
}Expected output:
10