Open Ashleybrandon opened 1 year ago
Hello @Ashleybrandon
Thanks for your question.
Structs are great resources for both organization and optimization.
For example, lets pick the Ballot contract. If we couldn't struct data in solidity, we would have to keep and manage several mappings to keep each attribute of a voter, and also several arrays to keep every attribute of each proposal.
This wouldn't only be more costly, but also more prone to error to manage, not to mention the organization and amount of code to do the same thing without structs.
Why do structs exist in Solidity? Trying to understand their purpose beyond classes/objects. Thanks so much.