More concise syntax for accepting multiple return values

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

argv
Posts: 184
Joined: Tue Aug 30, 2016 4:47 pm

More concise syntax for accepting multiple return values

Post by argv »

Currently, in order to receive multiple return values, one must separately declare the variables (without type inference), then call the method and assign the return values to the variables.

It would be preferable to be able to do this with a single ‘let’ statement, like with single return values:

Code: Select all

let [number, another, success] = MyFunction(1, 2);
It would also be preferable to be able to discard some of the return values, without assigning them to variables:

Code: Select all

int b;
[_, b] = MyFunction(1, 2);

Return to “Feature Suggestions [GZDoom]”