It's helpful to experiment with language syntax in a REPL tool before pasting code into your editor.
REPL is an acryonym for Read, Evaluate, Print, Loop. REPL tools are simple interactive programming environments primarily used to validate syntax and algorithms.
Swift
The main Swift REPL tool is the Playground feature