String Interpolation
1. Basic Interpolation
Phần tiêu đề “1. Basic Interpolation”let name = "Alice"let age = 25
print("Hello, \(name)!")print("I am \(age) years old")2. Expressions
Phần tiêu đề “2. Expressions”let a = 10let b = 20
print("Sum: \(a + b)")print("Max: \(max(a, b))")3. Properties và Methods
Phần tiêu đề “3. Properties và Methods”let numbers = [1, 2, 3, 4, 5]
print("Count: \(numbers.count)")print("Sum: \(numbers.reduce(0, +))")4. Multi-line với Interpolation
Phần tiêu đề “4. Multi-line với Interpolation”let name = "Bob"let items = ["Apple", "Banana"]
let message = """ Hello, \(name)! You have \(items.count) items: \(items.joined(separator: ", ")) """📝 Tóm tắt
Phần tiêu đề “📝 Tóm tắt”\(variable)- Variable interpolation\(expression)- Expression interpolation- Hoạt động trong regular và multi-line strings