Last updated on September 24, 2019
Concatenation is to link together two objects of any type. Let’s say we would like to concatenate A & B, it just means we would like to link A & B together and the output would be A B.
In this tutorial, you’ll learn what is interpolation. You’ll learn:
- How to use Concatenation.
- The differences between Interpolate and Concatenation.
To follow along this tutorial, you’ll need some basic knowledge in:
- Basic familiarity in Swift
- At least Xcode 7.1
let a = "a" let b = "b"
let output = a + b // ab
let output1 = "A: \(a) " + "B: \(b)" // A: a B: b
There are time that you would like to concatenate a data with a description and you could use the
output1 or in times you only would like to concatenate the data, then you could use
Do take note that this is different with concatenate as concatenate involves combining both value while interpolation is an insertion of a value into a string.
Where to go From Here
If you feel like you are ready to take on more challenges, feel free to check out some other tutorials that we have created: