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 ...