1

I wanna know how to get multiple return values from function in Solidity Thanks!

1 Answer 1

3

In Solidity was old method to get multi-return values from function through keyword var but is was deprecated in 0.5.0 if i'm not mistake

Solidity allows functions to return multiple values. Here is an example to demonstrate this:

{ 
    function a() returns (int a, string b) 
    { 
        return (1, "Hello"); 
    } 

    function b() 
    { 
        int A; 
        string memory B; 

        //A is 1 and B is "Hello" 
        (A, B) = a(); 

        //A is 1 
        (A,) = a(); 

        //B is "Hello" 
        (, B) = a(); 
    } 
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.