Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Value Arguments

A routine may have an arbitrary but usually fixed number of value arguments (see variadic routines for variable argument lists).

Explicit value argument with types

Arguments are specified in a routine declaration surrounded by parentheses (/) and separated by commas. Argument types are given after a single argument, e.g., on bool, or after a list of comma separated arguments, e.g., x, y, z i32.

Arguments declared for a constructor are shown in this example:

Arguments declared for a function:

Argument Type Inference

Argument types may be omitted if they belong to a routine that is not public, i.e., not visible to other modules, the routine is called and the types can be inferred from the actual arguments in the calls. This ensures that argument types in public are clearly documented and may not change accidentally by changing the type passed to a call. This is less of a problem within one module, i.e., one compilation unit that would make type errors visible immediately.

The constructor example from above can hence be written as

and the function can also be simplified:

Note that argument type inference results in one fixed argument type, a routine using argument type inference is not type polymorphic. A later section will explain how type parameters can be used for this.

Result Type Inference

Similarly to the argument type that may be omitted, the result type of a function can be omitted and inferred from its result expression. Again, this is only permitted for non-public functions.

Using the example from above, we can omit the result type String since this is the static type of the result expression start + "-"*l + end:

last changed: 2026-02-20