बाकी
Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi 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