The program shape in Swift
The smallest Swift: top-level code, print, interpolation.
// A Swift file runs top to bottom; print writes a line.
let club = "Halyard Sailing Club"
print("Race day at \(club)")
print("Boats registered: \(9 + 5)")
How it works
- A main.swift-style file runs top to bottom, no main function.
letbinds the club's name once.\(9 + 5)interpolates any expression into the string.
Keywords and builtins used here
letprint
The run, in numbers
- Lines
- 4
- Characters to type
- 155
- Tokens
- 28
- Three-star pace
- 75 tpm
At the three-star pace of 75 tokens a minute, this run takes about 22 seconds.
Step 1 of 3 in Values, step 1 of 27 in Language basics.