iOS Swift Basics Swift Types String Manipulation

Jubin Sebastian
Jubin Sebastian
801 Points

concatenating

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

Above is my code to get the value "Hi there, Pasan. How are you?"

please tell me what is wrong in this code.

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

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 43,535 Points

Concatenation uses the concatenation operator

let finalGreeting = greeting + ". How are you?"