Skip to content

Hello, world!

Create a file called hello.plu:

println("Hello, world!")

Run it:

Terminal window
pluvial hello.plu
Hello, world!

println(x) prints a value followed by a newline. Its sibling print(x) prints without a trailing newline. Both accept any value type — int, float, bool, string, array<T>, Result<T>, or a nullable T? — with a single argument.

def greet(string name) string {
return "Hello, " + name + "!"
}
string who = "Pluvial"
println(greet(who))
Hello, Pluvial!

A few things to notice:

  • Functions are declared with def. Parameters are written type name, and the return type goes between the ) and the { (Go-style trailing return type).
  • Variables are declared as <type> <name> = <initializer>. The initializer is required.
  • string + string concatenates. Mixing types — for example "count: " + 3 — is a compile error; convert explicitly with to_string(3).

Running pluvial with no arguments starts an interactive Read-Eval-Print Loop. Typing an expression prints its value; declarations and statements persist across lines:

$ 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
$

If a line has an error, the REPL prints the error block and keeps the session alive so you can continue typing. See the CLI reference for the full REPL behavior.

Line comments start with # and run to the end of the line:

# this is a comment
auto x = 1 # trailing comments work too

Documentation comments start with ## at the beginning of a line and attach to the declaration that follows them; pluvial doc renders them to Markdown.