0Pricing
Swift Academy · Lesson

Integer Types and Their Ranges

Understand Int, UInt, Int8..Int64 and their bounds.

Integer Types in Swift

Swift has several integer types. Int is the default and matches the platform word size (usually 64-bit). There are also fixed-width types like Int8, Int16, Int32, and Int64.

let count: Int = 42
print(count)
print(type(of: count))

Signed vs Unsigned

Signed types (Int) can hold negative and positive values. Unsigned types (UInt) hold only zero and positive values, gaining a larger positive range.

let signed: Int = -10
let unsigned: UInt = 10
print(signed, unsigned)

All lessons in this course

  1. Integer Types and Their Ranges
  2. Floating-Point: Double vs Float
  3. Explicit Numeric Conversions
  4. Numeric Literals and Underscores
← Back to Swift Academy