print something in swift

To print something in Swift, you can use the print() function. For example:

main.swift
print("Hello, world!")
23 chars
2 lines

This will print the string "Hello, world!" to the console. You can also print variables by including them in the parentheses:

main.swift
let name = "Alice"
let age = 30
print("Name: \(name), Age: \(age)")
68 chars
4 lines

This will print "Name: Alice, Age: 30" to the console.

gistlibby LogSnag