iOS Swift Basics Swift Types String Manipulation

Jubin Sebastian
Jubin Sebastian
801 Points

I am unable to get the ans

let name = "Pasan" let gre = "Hi there" let greeting = "(gre), (name)" let how = "How are you?" let finalGreeting = "(greeting). (how)"

strings.swift
// Enter your code below
let name = "Pasan"
let gre = "Hi there"
let greeting = "\(gre), \(name)"
let how = "How are you?"
let finalGreeting = "\(greeting). \(how)"

1 Answer

Jeff McDivitt
Jeff McDivitt
23,963 Points

Hi There Jubin -

The directions state to use the constants (name, greeting, and final greeting) so you do not need the other declarations that you are using. You are using concatenation to piece together a full sentence. I would suggest going back to the videos so you fully understand this concept as it will be a crucial building block in your coding career! Keep practicing what you have learned :)

let name = "Jeff"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting)." + "How are you?"