Web 3 Solidity - Datatypes in Solidity
🧶 thread ↓
🧶 thread ↓
Like in any other programming language, datatypes in Solidity can be classified into two types: value and reference type.
Value types store values: for example, boolean stores true or false, and the datatype of uint stores positive integers.
On the other hand, reference types don't store values, they store a reference to where the actual data is stored. For example, an array is a data type of type reference. An array stores a reference to where the actual array elements are stored.
In this thread, I will be discussing value type datatypes.
Examples of value types in solidity:
Examples of value types in solidity:
• uint - unassigned integer stores numbers that are greater or equal to zero.
So you can't use negative numbers with unassigned integers. Uint is the same as uint256, and uint256 ranges from 0 to 2**256 - 1.
So you can't use negative numbers with unassigned integers. Uint is the same as uint256, and uint256 ranges from 0 to 2**256 - 1.
• Uint only supports positive numbers, so no negative numbers, but what if you want to use negative numbers?
Fortunately, solidity has the int that supports both negative and positive numbers.
Fortunately, solidity has the int that supports both negative and positive numbers.
That is it for this thread. I hope you found it useful. If you need any help, please let me know in the comment section.
I know I didn't cover all the datatypes in solidity, but these are the common ones you will be using more often.
I know I didn't cover all the datatypes in solidity, but these are the common ones you will be using more often.
If you found this thread helpful,:
🔁RT the first tweet and help others find this thread
✅Follow me @xtremepentest
For more amazing Solidity content.
🔁RT the first tweet and help others find this thread
✅Follow me @xtremepentest
For more amazing Solidity content.
Loading suggestions...