Language Tour

A practical walkthrough of the current Jot syntax and behavior.

Jot programs are newline-separated statements.

Variables and expressions

let a = 10
let b = 20
print(a + b)

Blocks return values

let value = {
  let x = 2
  let y = 3
  x * y
}

print(value)

If a block does not end with an expression statement, its value is null.

Conditionals are expressions

let abs = fn(n) if n < 0 then 0 - n else n
print(abs(5))
print(abs(0 - 5))

While loops

while is a statement. Use a block body for multiple statements.

let i = 0
while i < 3 {
  print(i)
  i = i + 1
}

Functions are values

let add = fn(a, b) a + b
print(add(2, 3))

Lists and built-ins

let items = [1, 2]
push(items, 3)
print(items)

For exact precedence, scope, and runtime rules, continue to Language Reference.