Using the REPL
Once we have Swift installed, we can use the Swift REPL (Read Evaluate Print Loop) environment and give Swift a test run on Linux. The Swift REPL environment and LLDB debugger are tightly linked to the toolchain, which aids in Swift type inference, syntax, and expression evaluation. Basically, it makes the compiler, debugger, and REPL environment's jobs easier if there is only one version of Swift to worry about at a time. Let's start the REPL environment and execute a few commands to get familiar with the REPL environment's capabilities.
To start the Swift REPL, you type the swift command:
$ swift
As we add statements, the REPL environment is smart enough to only execute once you have completely entered a statement. We can create assignment statements, functions, or even entire classes.
At the REPL prompt, let's assign:
1> let oneMillion = 1_000_000
oneMillion: Int = 1000000
2> let twoMillion: Int = 2_000_000
twoMillion: Int = 2000000
3> oneMillion...