Why this fires
The call passes the wrong number of arguments for the function being called:
fn greet(name: str, greeting: str) -> str {
return "${greeting}, ${name}"
}
fn main() {
print(greet("Ada"))
// ^^^^^^^^^^^^ error: arity mismatch — expected 2 arguments, got 1
}
Arity is a hard error: the compiler can't pick a reasonable interpretation when the argument count is wrong, so it reports the mismatch and stops type-checking the call.
Fix it
1. Pass the missing arguments
print(greet("Ada", "Hello"))
2. Use default values on the signature
If most call sites want the same value, declare a default:
fn greet(name: str, greeting: str = "Hello") -> str {
return "${greeting}, ${name}"
}
greet("Ada") // ok — greeting defaults to "Hello"
greet("Ada", "Bom dia") // ok — greeting overridden
3. Use a variadic / rest parameter
For functions that genuinely take any number of arguments:
fn join(separator: str, ...parts: str) -> str { ... }
join(", ", "a", "b", "c")
See also
TE111— the count is right but a type doesn't match.- /docs/functions — default arguments, variadics, optional parameters.