There’s an even simpler way to include values in strings: Write the value in parentheses, and write a backslash (\
) before the parentheses. This is known as string interpolation.
let apples = 3
let oranges = 5
let appleSummary = "I have \(apples) apples."
let fruitSummary = "I have \(apples + oranges) pieces of fruit."