There are several elementary types in solidity that can be used together to form various complex user-defined types. In this recipe, you will learn about two user-defined types in Solidity: struct and enum.
Working with struct and enum
How to do it...
Let's create and work with various user-defined types using struct and enum.
Structs
Structs provide a way to define new types of solidity:
- Use the struct keyword for creating user-defined types in solidity:
struct Person { }
- Create a struct with a name and the associated properties inside it:
struct Person {
...