# Lesson 2: Value Types in Solidity

Published in

Introduction to value types

In Solidity, like in many other languages, data types can be broadly classified into two groups: reference types and value types. In this article, we will examine the various value types that are present in the language.

Let’s begin by defining what a value type is. A value type is a type that holds the data directly in the memory owned by it. Variables of these types are always passed by value, meaning that they are always copied when assigned to another variable or passed into a function.

The following types are value types in Solidity:

• booleans
• integers
• unsigned integers
• fixed-size byte arrays (`bytes1` to `bytes32`)
• enums
• fixed point numbers (they are not fully supported yet)

## Booleans

Booleans, of course, can hold two values `true` or `false`. Solidity supports all your regular boolean operators, such as `!`, `&&`, `==` etc. They only take up 1 byte of storage.

`bool public a_boolean;`

## Signed and unsigned integers

Signed integers are declared with the `int` keyword, unsigned integers with the `uint` and both take up 32 bytes by default. If you know your variable will never hold that many bytes you can always make it smaller by explicitly specifying the number of bits. For example `int128`/`uint128`. You can specify this in steps of 8 starting from 8 up till 256. You can use regular comparison, arithmetic, and bitwise operators on both `int` and `uint`.