# Integer

esse quam videri

## Contents

# Definition

Integers are a data type that are 32 bits in size. They cannot hold any decimal places, are whole numbers, and can be positive or negative.

# Relevance

Integers are commonly used for counting in programming such as for indexes in collections or keeping track of iterations in loops.

# Explanation

Integers can be used for arithmetic expressions such as addition, multiplication, division in programming. However, if the result is being saved into an integer, the result should be a whole number. Otherwise, the result will truncate (round to a whole number) which may create undesired results.

```
int a = 5;
int b = 2;
int c = 2.5; // not allowed as integers cannot hold decimal places.
int result1, result2, result3; // You can also declare several variables of the same type this way.
result1 = a + b; // result1 = 7
result2 = a * b; // result2 = 10
result3 = a / b; // result3 = 2 because the decimal places will not be saved.
```