0

https://medium.com/coinmonks/solidity-tutorial-returning-structs-from-public-functions-e78e48efb378

According to this article (link above), on Medium I'd have to use tuples... but this was so in Solidity v0.4.13 is possible now in v0.4.22 to do it without using tuples? Or do I still have to use tuples? I've also seen an method that uses "experimental ABIEncoder" so is there a better way... what options are there to return structs from public functions ?

0

No, unfortunately this

pragma solidity 0.4.24;

contract Demo {
    struct SimpleStruct {
        uint256 a;
        uint256 b;
        address c;
    }

    function returnsSimpleStruct() public view returns (SimpleStruct){
        return SimpleStruct(0, 0, address(0));
    }

}

does not compile witout pragma experimental ABIEncoderV2;

  • Thanks @Henk, I think I'll just use the tuple method as this is still experimental... – YulePale Aug 15 '18 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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