Methods syntax

Named arguments

Call-site argument labels: name = value.

Named arguments reorder to match the selected overload after resolution. Works with constructors and methods. Java interop requires -parameters on Java compilation for external APIs.

Affogato

example.aff
let user = User(name = "Ada", id = 42)
println(greet(name = "World", times = 2))

Generated Java

Example.java
final User user = new User("Ada", 42);
System.out.println(greet("World", 2));

Related

See also

← All keywords