Numbers, Booleans and Characters
Working with Int, Double, Float, Bool, and Character types.
Welcome
Swift has a rich set of built-in numeric types, a Boolean type, and a Character type for representing single Unicode scalars. Let's explore each.
Integer Types
Swift provides signed and unsigned integers at various bit widths:
```swift
let a: Int = -42 // platform width (64-bit)
let b: Int8 = 127
let c: UInt = 255
let d: UInt8 = 200
```
Use `Int` for general-purpose integers; sized types when memory layout matters.
All lessons in this course
- let vs var: Constants and Variables
- Type Inference and Explicit Types
- Numbers, Booleans and Characters
- String Fundamentals and Interpolation