0
struct Proposal{
    uint32 id;
    string text;
    bytes docs;
    bool selected;
    uint expectedBudget;
    address submitter;
}



// _text and _expectedBudget already define.

Proposal proposal = Proposal({
                      id:getId(),
                      text:_text,
                      docs:<what_should_I_use_here>,
                      selected:false,
                      expectedBudget:_expectedBudget,
                      submitter: msg.sender
                    })

I want to set something like null for docs. what to use in solidity?

1

Something like that should work

Proposal proposal = Proposal({
                  id:getId(),
                  text:_text,
                  docs:'',
                  selected:false,
                  expectedBudget:_expectedBudget,
                  submitter: msg.sender
                })

The value of docs will be 0x.

That being said, consider using bytes with a fixed length like bytes32, it is much cheaper.

See the official documentation for more precision.

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.