Skip to content

Using tuples as arguments #17274

Closed
Closed
@brain113

Description

@brain113

In rust we have possibility to return several values in tuple. But we can't use it vice versa: to put several arguments to function in tuple. Like this:

fn main() {
    sum(prepare_args());
}

fn sum(x: int, y: int) -> int {
    x + y
}

fn prepare_args () -> (int, int) {
    (1, 2)
}

I think it will be very usefull.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions