Codecademy Logo

Hello World

Print Cheatsheet

print()

The print() function outputs one or more values to the terminal.

print("Hello, world!") // Prints: Hello, world!

Program Structure

The program runs line by line, from top to bottom:

  • Line 1 prints Hola
  • Line 2 prints Buenos días
print("Hola") print("Buenos días")

Single-line Comments

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

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! */