Your first Pliro program
Start in the Pliro editor. Create a source file, copy the complete example below, and choose Run. Look for the messages in the output panel. You can do this before learning any command-line tools.
The program remembers a name and the number of lessons finished. It then chooses a message. Predict the two output lines before running it.
# language: en
let name = "Pliro"
let lessonsFinished = 1
say "Hello, " + name + "!"
if lessonsFinished == 1:
say "You finished your first lesson."
else:
say "Every program starts with one small step."
Try a small change
Change lessonsFinished from 1 to 0. Which message changes? The greeting should stay the same. If you get an error, check the quotation marks and keep the indented lines inside their blocks.
Using the command line
Save a standalone source file with the .pliro extension. From the repository,
it can be checked or run with:
go run ./cmd/pliro check program.pliro
go run ./cmd/pliro run program.pliro
An installed compiler uses the shorter commands:
pliro check program.pliro
pliro run program.pliro
Program statements execute from top to bottom. let declares a name, say
prints values, and the indented blocks belong to the if and else clauses.
