by argv » Fri Jun 29, 2018 10:19 pm
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:
Currently, in order to receive multiple return values, [url=https://zdoom.org/wiki/ZScript_functions#Multiple_Returns]one must separately declare the variables (without type inference), then call the method and assign the return values to the variables.[/url]
It would be preferable to be able to do this with a single ‘let’ statement, like with single return values:
[code]
let [number, another, success] = MyFunction(1, 2);
[/code]
It would also be preferable to be able to discard some of the return values, without assigning them to variables:
[code]
int b;
[_, b] = MyFunction(1, 2);
[/code]