Read Eval Print Loop (REPL)

The Swift Read Eval Print Loop or REPL is an interactive terminal interface for Swift. Type the swift command in the terminal to launch the REPL. The REPL prompt is represented by an angle bracket >. Use the :exit or Control-D commands to exit the REPL environment.

// Start the Swift REPL in the terminal

$ swift
1>

// Perform a calculation in the REPL

1> 1 + 4.5
$R0: Double = 5.5

Gavin Wiggins © 2021