how do I return an array of strings? This is my code:

contract PlanetEarthContract {
    string[7] continents;
    constructor() public {
        continents = ["North America", "South America", "Europe", 
        "Asia", "Oceania", "Antartica", "Africa"];}

        function getCountries() public view returns(string[7] memory){


But I get the error

This type is only supported in the new experimental ABI encoder.

1 Answer 1


You can't do it without the experimental ABI encoder. You can turn that on with, per https://solidity.readthedocs.io/en/v0.5.11/layout-of-source-files.html#abiencoderv2:

pragma experimental ABIEncoderV2;

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.