typestar

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

  1. A .fsx script needs no main; it runs as it reads.
  2. let binds values; nothing here ever reassigns.
  3. printfn "%s" and %d format like C with type checking.

Keywords and builtins used here

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.

Type this snippet

Step 1 of 3 in Values, step 1 of 27 in Language basics.

Next →

The script shape in other languages