Focus mode

Smart Contract Development with Solidity

Structs

Code from video: https://solidity-by-example.org/structs/ 

You can access the video content in Turkish prepared by İTÜ Blockchain here: https://www.youtube.com/watch?v=lV_QtWkp3MY&list=PLby2HXktGwN4Cof_6a8YwlMrboX8-hs73&index=7&t=2s 

Structs are a collection of variables and work the same way that objects do in Javascript. You can declare a struct to have multiple properties and once you create a new struct, they will also have the same properties.

Structs in Solidity allow you to create more complicated data types that have multiple properties. You can define your own type by creating a struct.

They are useful for grouping together related data.

Structs can be declared outside of a contract and imported into another contract. Generally, it is used to represent a record. To define a structure struct keyword is used, which creates a new data type.

Resources:

You can find detailed further information from Solidity Official documentation (in English):

https://docs.soliditylang.org/en/v0.8.15/types.html#structs 

https://www.geeksforgeeks.org/solidity-enums-and-structs/

Test

Comments

You need to enroll in the course to be able to comment!