string concatenation in swift code example

Example 1: swift string concatenation

let age = 28
let name = "John"
let isAlcoholic = true

var description = "\(name) is \(age) years old and \(isAlcoholic ? "is" : "isn't") alcoholic"

Example 2: concatenate string swift

let string1 = "hello"
let string2 = " there"
var welcome = string1 + string2 // hello there

Example 3: how to concatenate two strings in swift

var greet = "Hello, "
let name = "Jack"

// using + operator
var result = greet + name
print(result)

//using =+ operator
greet +=  name
print(greet)