Concatenation operation

Learn how how to join strings.

The concatenation operation combines two strings into a single string. This is useful when you need to format strings, such as when you want to create a full name by combining a first and last name.

To concatenate two strings, place the & operator between them:

/*<prefix>*/ & /*<suffix>*/
Try in Playground

Here is a practical example:

"CQL " & "💚" // CQL 💚
Try in Playground

You can also combine more than two strings by using multiple & operators:

"C" & "Q" & "L" // CQL
Try in Playground

When you concatenate a string with a non-string value, the non-string value is converted to a string before concatenation:

"1 + 1 = " & 2 // 1 + 1 = 2
Try in Playground

For more information about how conversion to string works, see string conversion.