Data type

Solidity is a statically typed language. Developers familiar with language such as JavaScript and Python will find Solidity syntax easy to pick up. Each variable needs to specify the data type. The variable, which will always be passed by value, is called value types, it is built-in or predefined data types.

The value types in solidity are as follows:

Types

Operators

Example

Note

Bool

!, &&, ||, ==, !=

bool a = true;

The Booleans are true or false expressions.

Int (int8 to int256)

Comparison operators:

<=, <, ==, !=, >=, >,

Bit operators: &, |, ^, +, -, unary -, unary +, *, /, %, **, <<, >>

int a = 1;

Signed integer, signed of 8 up to 256 bits, in the step of 8.

Uint (uint8 to uint256)

Comparison ...

Get Blockchain Development with Hyperledger now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.