Skip to content
Justice Tech School

Basic Types

Int, Double, Float, Bool, String and Character. Types are never converted implicitly.

Example
let i: Int = 7
let d: Double = 2.5
let f: Float = 1.5
let b = true
let c: Character = "S"
print(i, d, f, b, c)
print(Double(i) + d)

Exercise

Convert to Double.

(i)

Quiz Test

Does Swift convert Int to Double automatically?

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