Tsallaka zuwa abun ciki
Justice Tech School

Swift Data Types

Common types: Int, Double, Float, Bool, String and Character. Swift never converts types silently, so wrap values with the type name such as Double(x).

Example
let i: Int = 42
let d = 3.5
let ok = true
let c: Character = "S"
print(Double(i) + d, ok, c)

Exercise

Convert Int to Double.

let x = (i)

Quiz Test

Does Swift convert Int to Double implicitly?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.