Heroes / Esempi / 00-first

examples/gallery/00-first.hero

Il primo programma eseguito dal compilatore: stampa un numero.

Basta un file con una funzione main. Questo esempio non richiede import, cioè dichiarazioni per usare altri moduli, né un file di progetto o una classe.

Eseguilo

$ heroes run examples/gallery/00-first.hero

Questo esempio serve a illustrare il linguaggio. Qui trovi il programma e non un risultato: non ci sono ancora test che confrontino il suo output byte per byte.

Il programma

## First
#
# The smallest program worth compiling — the M-scalars-run acceptance input.
# Its C target, written by hand, was tools/spike/01-first.c (gone since 2026-10-25);
# in M-scalars-run the emitter's output was compared against that file by eye.

function main()
    print((2 + 3) * 4)
examples/gallery/00-first.hero, 8 righe

impronta sha256 a205436ed1cf · 1 file · index.json

Successivo: 01-points. Tutti gli esempi.

Eseguine uno: i quattro comandi. Impara il linguaggio, oppure leggi la specifica completa in un solo file.