Synsema docsENES

Syntax

Synsema reads like prose. Blocks are defined by indentation (4 spaces or 1 tab) — there are no curly braces.

syntax.syn
-- Doc example: core syntax. Universal code; English comments.
intent: "doc example: variables, operators, pipe, inline conditional"

task double(n)
    give n * 2

print("5 |> double = " + text(5 |> double))    -- run shows: 5 |> double = 10

test "let / set / arithmetic"
    let x be 10
    set x to x + 5
    assert_eq(x, 15)
    assert_eq(10 % 3, 1)

test "comparison + boolean logic"
    assert(1 < 2 and 2 <= 2)
    assert(true or false)
    assert(not false)

test "pipe is unary application: x |> f == f(x)"
    assert_eq(5 |> double, 10)

test "inline conditional is an expression"
    let label be when 80 >= 50 then "pass" otherwise "fail"
    assert_eq(label, "pass")

Variables

let name be value introduces a binding; set name to value reassigns it.

Operators

Inline conditional

when cond then a otherwise b is an expression (usable inside let, a map, or a call), distinct from the when block statement.

Strings

Comments

-- a comment runs to end of line.