print() function outputs one or more values to the terminal.
print("Hello, world!") // Prints: Hello, world!
The program runs line by line, from top to bottom:
- Line 1 prints
- Line 2 prints
print("Hola") print("Buenos días")
Single-line comments are created using two consecutive forward slashes. The compiler ignores any text after
// on the same line.
// This line denotes a comment in Swift.
Multiline comments are created using
/* to begin the comment, and
*/ to end the comment. The compiler ignores any text in between.
/* This is all commented out. None of it is going to run! */