lessonΒ·20 minΒ·Chapter 1 of 3
Structs & Enums
Structs let you define custom types that group related data. For example: `struct Token { string name; uint256 totalSupply; address owner; }`. Enums define a finite set of named values, useful for state machines: `enum Status { Pending, Active, Closed }`. Both can be used as state variables, in mappings, or as function parameters. Structs are stored in storage by default when declared as state variables, but can be in memory for function-local use.
π‘ Key Takeaway
This lesson covers the fundamental concepts. Make sure you understand these before moving to the next chapter.