A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ziglang/zig/issues/982 below:

Optional argument names in function calls · Issue #982 · ziglang/zig · GitHub

fn foo(a: u8, b: usize, c: []const u8) void {}

test "optional argument names" {
    foo(c: "Hi!", 0, 42); // -> foo(0, 42, "Hi!");
    foo(a: 0, c: "bar", 10); // -> foo(0, 10, "bar");
}

Invalid argument names obviously cause a compile error.
To match the arguments, we simply look at the named arguments first, then match the rest in the same order they appear in the function definition.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4