swift-for-python-programmers

Datatypes

🏡

1. Integers

Swift provides signed and unsigned integers in 8, 16, 32, and 64 bit forms

let maxInt = UInt8.max
let minInt = UInt8.max

2. Floating Point

Float 64 bit, Double 32 bit

3. Booleans

Booleans or bool can be either true or false

4. Tuple

let http404 = (404, "Not Found")

Named tuples are similar to Python dictionaries

let http200Status = (statusCode: 200, description: "OK")

print("The status code is \(http200Status.statusCode)")