1

i have consulted this thread: How can I return multiple strings from a contract function?

but i cant find a way to adapt it, as the number of variables i need to return is not set.

here is my top 10 PhD certified code:

mapping (uint256=>string)  fieldNameArr; //filled in another function
function getAllFields()  public view returns (string){
    uint g;
    for(g=0;g<=e ;g++){

        arr.push(bytes(fieldNameArr[g]));
        arr.push(",");

    }  
return (arr);
} 

Remix is returning an error regarding the type, but i have tried a lot of tricks to solve this and i can't find a way.

Please ask for precision if you need any. Thank you for your help.

1

It is not possible to return (yet) a dynamic amount of values in solidity. In particular arrays. It is said in the documentation. Check this: http://solidity.readthedocs.io/en/v0.4.21/control-structures.html?highlight=multiple%20return#returning-multiple-values

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.