Solidity is a statically typed language, which means every variable declared must have a type of data to store.

Variables declared in a program to store the data. Solidity provides two types of data types.

It allocates memory size based on datatype.

  • Value Types
  • Reference Types

Solidity Value Types

  • Bool It is a boolean, that contains true/false -Integer types

It provides multiple various integer types

Solidity provides multiple types to store signed and unsigned integers.

singed integers types: It uses stores positive and negative numbers

unsigned integers types: It uses store positive numbers

IntUint
Signed and unsigned numbersUnsigned numbers only
Contains Positive and negative valuesPositive values
int8 : - 128 to +127uint8 range is 0 to 255
int8 to int 256uint to uint256
verticalPositionVertical position - ’top’,’ bottom'

Notes:

The default value is zero for int and unit types Solidity prevents Overflow errors at compile time only

-Fixed Point Numbers

These are used to store floating numbers with decimal values.

It provides signed and unsigned fixed-point numbers with multiple sizes singed Fixed types: It uses stores positive and negative numbers unsinged Fixed types: It uses store positive numbers

-fixed/ufixed: It is an alias fixed128x18/ufixed128x18. -fixedMxN/ufixedMxN:

M represents several bits, and the value is divisible by 8. 8 to 256. N represents the number of decimals

FixedUnsigned Fixed Numbers
Signed and unsigned Fixed numbersUnsigned Fixe numbers only
Contains Positive and negative valuesPositive values
Type is Fixedufixed type
Fixed is an alias for fixed128x18ufixed is an alias for ufixed128x18
fixedMxN

Solidity Address Type

the address is a type in the solidity that stores blockchain address memory location.

It contains a 20-byte value.

The address contains a properties balance and transfer

solidity Fixed-size byte array types

It provides multiple byte types - bytes1, bytes2bytes32.

Another type, bytes is an alias for bytes1.