The script shape in F#
The smallest F#: let bindings and printfn, top to bottom.
// A script runs top to bottom; printfn formats and writes a line.
let apiary = "Foxglove Meadow"
let hives = 7
printfn "Inspection day at %s" apiary
printfn "Hives to open: %d" hives
printfn "Frames if all full: %d" (hives * 10)
How it works
- A .fsx script needs no main; it runs as it reads.
letbinds values; nothing here ever reassigns.printfn "%s"and%dformat like C with type checking.
Keywords and builtins used here
let
The run, in numbers
- Lines
- 7
- Characters to type
- 230
- Tokens
- 30
- Three-star pace
- 75 tpm
At the three-star pace of 75 tokens a minute, this run takes about 24 seconds.
Step 1 of 3 in Values, step 1 of 27 in Language basics.