A tour in five minutes
Brackets each have one job:
| Bracket | Job |
|---|---|
[ ] |
sets and lists: permissions, lists, paths |
{ } |
blocks of code and records; {name} inside a string interpolates |
( ) |
calls and grouping; the condition of if, for, match |
< > |
type parameters only, as in Secret<String> |
needs [ read [./src], run ["npm test"] ] // 1. the file starts with needs
let name = "world" // 2. let is fixed, mut changesmut count = 0let msg = "hello {name}" // {} interpolateslet files = [./a.ts, ./b.ts] // [] is a list; paths are barelet cfg = { port: 8080, host: "x" } // {} is a record
let t = run("npm test")? // 3. calls; ? passes a failure uplet n = read(./count.txt) or { "0" } // or { } handles it here
if (t.failed) { log("failing") } else { log("ok") }for (f in files) { log(f) }
let token: Secret<String> = env("TOKEN") // 4. a secret can be used, never printedFive things to remember:
- The file starts with
needs [ ... ]. letis fixed,mutis changeable.- Paths are written bare:
./src. - Failure is a value:
?passes it up,or { }handles it. - A secret can be used but never printed.
Statements end at the newline: no semicolons. Comments start with //.