Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hello world

Create hello.rmt:

say "Hello, world!"

print works the same way (print "Hello, world!"). Romit keeps say as the preferred short form; print is an alias for beginners coming from Python or Lua.

Run it:

romit run hello.rmt

You should see:

Hello, world!

Spec form (optional)

The same greeting as a full spec with a test lives in examples/beginner/hello_world.rmt:

spec HelloWorld version 1
output Greet
  message text
event Run
on Run
  rule say_it
    when true
    emit Greet with message "Hello, world!"
test says_hello
  send Run
  expect emitted Greet with message "Hello, world!"
romit test examples/beginner/hello_world.rmt

Use say or print scripts for small programs; add a spec only when you want optional checks, invariants, and tests.

romit run examples/beginner/print_alias.rmt

Variables in scripts

Assign with x = 5 (short form) or set x to 5 (readable form). Both mean the same thing; spacing after = is optional (x=5 works too).

total = 3 times 4 plus 2
say "Total: " total
x = 5
x = x plus 1
say x

The wordy form is still fine:

set total to 3 times 4 plus 2
set x to 5
romit run examples/beginner/assign_equals.rmt

Expected output:

Hi Ada
Total: 14
6

For a landing page, see UI framework and examples/ui/landing.rmt — the compiler fills in layout and theme defaults.