Understanding the correct use of String Interpolation?
Hello, it appears I was stuck on the quiz question because I typed the code as:
let name = "Natia" let greeting = "Hi there" let interpolatedGreeting = "\(greeting), \(name)"
But after reading you guys questions here I learned the correct way to type is:
let name = "Natia" let greeting = "Hi there, \(name)"
when put into Xcode both printed the correct results. However, the quiz only accepted the second version.. which is weird because in the video he only showed us the first way? Can someone help me better understand why it is "correct" to write it the second way? And which is better practice?
Short version of my ramble above: you answered your own question perfectly.