docs

You are reading the docs for v0.1.0. Nabi 0.1.0 is no longer supported. Latest release: v0.1.3 →

#E0049: invalid named argument

A named argument (f(x: 1)) names no parameter of the function, gives one parameter twice, is passed to a fn value (whose type has no parameter names), or comes before a positional argument. Use the parameter names of the function's definition, each once, after the positional arguments.

nabi
fn area(w: i32, h: i32 = 1) -> i32 { w * h }
println(f"{area(w: 2, height: 3)}");
error[E0049]: `area` has no parameter named `height`
  --> main.nabi:2:12
   |
 2 | println(f"{area(w: 2, height: 3)}");
   |            ^^^^^^^^^^^^^^^^^^^^^

Use the parameter names of the definition:

nabi
fn area(w: i32, h: i32 = 1) -> i32 { w * h }
println(f"{area(w: 2, h: 3)}");
6

Related: E0048 wrong number of arguments, E0050 ref parameter and argument mismatch

Found a mistake? Edit this page on GitHub. Last updated