Swift contains many of the standard numeric types that are suitable for storing various integer and floating-point values. Let's start off by looking at the integer type.
Numeric types
Integer types
An integer is a whole number and can be either signed (positive, negative, or zero) or unsigned (positive or zero). Swift provides several integer types of different sizes. The following chart shows the value ranges for the different integer types on a 64-bit system:
Type |
Minimum |
Maximum |
Int8 |
-128 |
127 |
Int16 |
-32,768 |
32,767 |
Int32 |
-2,147,483,648 |
2,147,483,647 |
Int64 |
- 9,223,372,036,854,775,808 |
9,223,372,036,854,775,807 |
Int |
- 9,223,372,036,854,775,808 |
9,223,372,036,854,775,807 |