O'Reilly logo

Learn Swift 2 on the Mac, Second Edition by Waqar Malik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    3

Accessing Swift’s Compiler and Interpreter: REPL

Let’s now investigate how to access the Swift compiler from the command-line interface known as the Read-Eval-Print-Loop, or REPL. This is where you can interact with the compiler by entering statements, which the compiler will interpret and evaluate immediately.

What Is REPL?

The REPL is an interactive shell similar to the UNIX shell and those of other languages such as Lisp, Ruby, and Python. When you start the shell, you are given a prompt to enter your code. The compiler interprets and evaluates the entered code and then prints either the result or an error.

If you don’t have Terminal in the Dock, locate the Terminal app in the Utilities folder and drag it to the Dock, then launch ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required