Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiply return values not supported. #42

Closed
Nashatyrev opened this issue Sep 2, 2015 · 4 comments
Closed

Multiply return values not supported. #42

Nashatyrev opened this issue Sep 2, 2015 · 4 comments

Comments

@Nashatyrev
Copy link
Member

solc compiles the following:

    function ret() returns (int a, int b) { 
        a = 1;
        b = 2;
    }

But no ways to get both a and b from return data. That feature would be very handy in absence of Struct returns.

@LianaHus
Copy link
Contributor

LianaHus commented Sep 2, 2015

sorry I can't understand the problem. So your example is working now. you have a and b in return data. could you please rephrase your question

@Nashatyrev
Copy link
Member Author

Sorry, I've probably missed something, but what is the syntax of calling such function and obtaining a and b from the returned data?

In my mind it should be something like

x, y = ret();

but that doesn't work

@LianaHus
Copy link
Contributor

LianaHus commented Sep 2, 2015

ah, sure. unfortunately now you still can't do that, but you can return struct from internal function(don't forget to add "internal" specifier before "returns").
we have pending story to implement something like: var [a, b] = fun();
https://www.pivotaltracker.com/n/projects/1189488/stories/99085194

@LianaHus
Copy link
Contributor

LianaHus commented Sep 7, 2015

@LianaHus LianaHus closed this as completed Sep 7, 2015
axic pushed a commit that referenced this issue Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants