in
Translation status: 繁體中文 reader-locale proof. Code fences render through the zh-Hant pipeline; prose is canonical Latin.
Marks a mutable borrowed parameter.
Syntax: in <type> <name>
Category#
function
Related#
Examples#
radix/corpus/in/in.fab (canonical · keyword)#
Marks a mutable borrowed parameter.
# =============================================================================
# in — Marks a mutable borrowed parameter
# =============================================================================
#
# What this teaches:
# • Marks a mutable borrowed parameter.
# • Related keywords: de, ex
#
# Common mistakes:
# • Mode mismatch — passing a `de` (read-only) value to an `in` position, or using `in` to mutate a parameter declared as `de` (SEM057).
#
# See also: de, ex
# =============================================================================
# in — value parameter passing mode
#
# GRAMMAR:
# paramMode :← 'in' type
#
# EXPECTED OUTPUT:
# Scalar stdout smoke (see body).
#
# BACKEND:
# Cross-ref: functio/in-ex.fab.
#
fn summa(mut list<int> values) → int {
return values.summa()
}
main {
const _ xs ← [1, 2, 3]
print summa(xs)
}Expected output:
6