Skip to content

Hello, world!

The shortest complete Pluvial program prints a greeting and exits:

hello.plu
println("Hello, world!")

Run it with the compiler:

Terminal window
pluvial hello.plu
# => Hello, world!
  • # starts a line comment.
  • println(x) writes x to standard output followed by a newline. It accepts any value type (int, float, bool, string, array<T>, Result<T>, T? — the same set understood by print(x)).
  • print(x) is the same, without the trailing newline. Use it to assemble a line in pieces.
  • Statements end at the end of the line. Pluvial does not use a statement terminator.

A bare expression is not displayed by default. The previous “evaluate-and-print” behavior was removed; output is always explicit via print or println.

Run pluvial with no arguments to start an interactive session:

$ pluvial
Pluvial REPL — type 'exit' to quit
> 1 + 2
3
> "hello".to_upper()
HELLO
> int x = 5
> x + 1
6
> def double(int n) int { return n * 2 }
> double(7)
14
> exit
$

The REPL keeps one VM instance for the whole session. Globals, functions, and struct definitions persist across lines; the value stack and call frames are reset between lines.

In REPL mode (and only in REPL mode), a bare expression is implicitly displayed — typing 1 + 2 prints 3. In file mode the same line evaluates and discards the result.

You can re-declare and re-type a global at the top level (int x = 5 then string x = "hi" is allowed). Re-defining a def or struct is rejected, the same as in file mode.

A compile error or runtime error keeps the session alive: the error block is shown and the prompt returns. Press Ctrl-D or type exit (or quit) on its own line to end the session.