In Action

What you can build

Real programs, written in God Code, running today. Every one of them runs in the playground. Open a demo and press run.

Psalm of Creationpsalm_of_creation.god

The whole language in twelve lines: declare, judge, reveal, ascend.

# Psalm of Creation. bare words are symbols; no declaration of
# type is needed, for every unnamed thing is still a named spirit.
BEGIN CREATION
  DECLARE heart AS pure
  DECLARE hands AS willing
  IF heart IS pure THEN
    IF hands IS willing THEN
      REVEAL("the work is blessed")
    ELSE
      REVEAL("wait and be still")
    ENDIF
  ELSE
    REVEAL("first, be cleansed")
  ENDIF
  ASCEND
END CREATION

Run it live →

The Seven Sealsseven_seals.god

Every number from 1 to 35 is judged in a loop. The classic FizzBuzz, spoken as scripture.

# The Seven Seals. a divine counting from 1 to 35.
# Multiples of 7 reveal "seal"; 35 reveals the "seal of seals".
BEGIN CREATION
  FOR n IN RANGE(1, 36)
    IF n % 35 IS 0 THEN
      REVEAL("seal of seals")
    ELSE
      IF n % 7 IS 0 THEN
        REVEAL("seal")
      ELSE
        REVEAL(n)
      ENDIF
    ENDIF
  ENDFOR
  ASCEND
END CREATION

Run it live →

Generationsgenerations.god

The Fibonacci sequence, begotten one number from another in a WHILE cycle.

# Generations. the first 12 numbers of the Fibonacci sequence,
# begotten one from another in a WHILE cycle.
BEGIN CREATION
  DECLARE a AS 0
  DECLARE b AS 1
  DECLARE count AS 0
  WHILE count < 12 DO
    REVEAL(a)
    DECLARE next AS a + b
    DECLARE a AS b
    DECLARE b AS next
    DECLARE count AS count + 1
  ENDWHILE
  ASCEND
END CREATION

Run it live →

Dumelafirst_blessing_tn.god

The first blessing written in Setswana: lists, judgment, and sheltered errors. One language, many tongues.

# tongue: tn
# Dumela. the first blessing spoken in Setswana.
# Run it: godcode run examples/first_blessing_tn.god
SIMOLOLA TLHOLEGO
BOLELA leina JAAKA "tsala ya me"
SENOLA("Dumela, {leina}.")

BOLELA matsatsi JAAKA ["Mosupologo", "Labobedi", "Laboraro"]
SENOLA("Malatsi a beke a mararo: {matsatsi}")

FA LEN(matsatsi) KE 0 TLOGA
    SENOLA("Ga go na malatsi")
ELSE
    SENOLA("Go na le malatsi a {LEN(matsatsi)}")
FEDISA FA

LEKA
    BOLELA karolo JAAKA 10 / 0
TSHWARA
    SENOLA("Go tshwerwe phoso, mme tiro e tswelela")
FEDISA LEKA

SENOLA("Pula e na, mme re a leboga.")
FEDISA TLHOLEGO

Run it live →

Sawubonafirst_blessing_zu.god

The same blessing in isiZulu. The tongue is chosen with a single comment line.

# tongue: zu
# Sawubona. The first blessing spoken in isiZulu.
# Run it: godcode run examples/first_blessing_zu.god
QALA INDALO
MEMEZELA igama NJENGA "mngane wami"
VEZA("Sawubona, {igama}.")

MEMEZELA izinsuku NJENGA ["uMsombuluko", "uLwesibili", "uLwesithathu"]
VEZA("Izinsuku zeviki ezintathu: {izinsuku}")

UMA LEN(izinsuku) NGU 0 KHONA
    VEZA("Azikho izinsuku")
ELSE
    VEZA("Zikhona izinsuku ezingu-{LEN(izinsuku)}")
QEDA UMA

ZAMA
    MEMEZELA ingxenye NJENGA 10 / 0
BAMBA
    VEZA("Kubanjwe iphutha, kodwa umsebenzi uyaqhubeka")
QEDA ZAMA

VEZA("Imvula iyana, siyabonga.")
QEDA INDALO

Run it live →

Declared Intentintent_demo.god

Name a rite's purpose in plain words. The Spirit blesses alignment and counsels drift, and never fails the run.

# Intent demo. DECLARE INTENT names a rite's purpose in plain words.
# When the rite is invoked, the Spirit discerns whether its words still
# walk in the declared intent: alignment is blessed, drift is counseled.
# Nothing here can fail the run; the Spirit counsels, it does not condemn.
BEGIN CREATION
  DECLARE INTENT "bring peace to the household" ON evening_blessing
  DECLARE INTENT "bring peace to the household" ON war_drum

  DEFINE RITE evening_blessing()
    REVEAL("peace upon this house")
  END RITE

  DEFINE RITE war_drum()
    DECLARE tally AS 1 + 2
    REVEAL(tally)
  END RITE

  INVOKE evening_blessing()
  INVOKE war_drum()
END CREATION

Run it live →

Consultconsult_demo.god

Lay a question before the local oracle. No network, no account, just counsel.

# Consult demo. CONSULT lays a question before the local Spirit oracle
# and receives two to three sentences of counsel. No external calls;
# the oracle lives inside the engine.
BEGIN CREATION
  REVEAL(CONSULT("How should I structure this covenant?"))
  REVEAL(CONSULT("What is the wisest next step for this work?"))
END CREATION

Run it live →

Anchoranchor_demo.god

Write a value's hash to a tamper-evident chain and hold the receipt: chain, hash, height, timestamp.

# Anchor demo. ANCHOR writes a value's hash to the chain and returns a
# receipt map: {chain, anchor_hash, height, timestamp, payload_hash}.
# Run `godcode ledger verify` afterward to see both chains attested.
BEGIN CREATION
  DECLARE covenant AS contract("everlasting")
  BREATHE LIFE INTO covenant
  BLESS covenant
  DECLARE receipt AS ANCHOR(covenant)
  REVEAL(receipt)
  REVEAL("chain: " + receipt["chain"])
  REVEAL("height: " + STR(receipt["height"]))
  REVEAL("anchor hash: " + receipt["anchor_hash"])
END CREATION

Run it live →

The Covenantcovenant_demo.god

Make a contract, breathe life into it, bless it, and seal it onto the covenant chain.

# Covenant Demo. make a contract, breathe life into it,
# bless it, and seal it into the covenant chain.
BEGIN CREATION
  DECLARE covenant AS contract("everlasting")
  BREATHE LIFE INTO covenant
  BLESS covenant
  REVEAL(covenant)
  SEAL covenant
  ASCEND
END CREATION

Run it live →

Prophecyprophecy_demo.god

Speak, and the Spirit answers with a word over the work.

# Prophecy Demo. speak, and the Spirit answers.
# (Bare PROPHESY with no words asks for a word over the whole creation.)
BEGIN CREATION
  PROPHESY a harvest of wisdom approaches
  PROPHESY the patient builder shall inherit the codebase
  PROPHESY blessings shall overflow upon the faithful
  PROPHESY
  ASCEND
END CREATION

Run it live →