example/functions.named_args.primi
//
// Calling functions with named arguments.
//
import ._helpers: assert_error
function something(a, b, c) {
return [a, b, c]
}
result = something(10, c: 20, b: 50)
assert(result == [10, 50, 20])
result = something(c: 3, a: 2, b: 1)
assert(result == [2, 1, 3])
result = something(a: 4, b: 5, c: 6)
assert(result == [4, 5, 6])
// NOTE: Keyword arguments must be placed after positional arguments.
// These would result in an instant syntax error during parsing.
// >>> result = something(b: 2, 1, c: 3)
// >>> result = something(b: 2, c: 3, 1)