4

Is it possible to have a mapping where the values are a tuple?

mapping (address => (bool, uint)) participants;

1 Answer 1

9

If you use a struct, eg

struct Participant {
    bool value1;
    uint value2;
}

mapping (address => Participant) participants;

I don't think there's any way of using an actual Tuple eg var (a, b) in a mapping since the types of a and b cannot be declared with the syntax available. With a struct the types can be declared, which is necessary to declare the mapping type.

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.