Swift is a type-safe language. That means the compiler always knows exactly what data type a variable holds. This lets it catch mistakes early — like putting text into a number, or a boolean into a string.
In Swift, you can write out a type explicitly, or let the compiler figure it out from the value — this is called type inference.
swift
let name: String = "Nandar" // Explicit type
let age = 24 // Int လို့ compiler ကခန့်မှန်းမယ်
let rating = 4.8 // Double
let isPremiumUser = true // Bool
print("\(name) is \(age) years old.")
print("Rating: \(rating), Premium: \(isPremiumUser)")String is for text, Int is for whole numbers, Double is for decimal numbers, and Bool is for true/false values. \(...) is called string interpolation, and it lets you drop a variable's value right into a string.
You should see
Nandar is 24 years old. Rating: 4.8, Premium: true