Print Multiple Strings using Single print()
To print multiple Strings using single print() function call, pass the strings as comma separated values to print() function.
The syntax to print multiple strings in a single print() function call is
print(string_1, string_2, string_3)
We can print as many strings as required.
Swift Example
In this example, we will print three strings to console using a single print() statement.
main.swift
import Foundation
print("abc", "mno", "xyz")
Program Output
abc mno xyz
print() uses a single space as default separator between the string items while printing to output. You may override this behaviour by specifying a value for separator
optional parameter during print() function call.
Summary
We have learnt how to print multiple strings to output in a single print() function call, in Swift.