Literals: values written directly in code

Concepts explained

A literal is a value written directly in the source. 12 is a number literal. "turtle" is a text literal. A variable name instead asks Pliro to look up a value.

# language: en
let animal = "turtle"
say animal
say "animal"
say 3 + 4

The output is turtle, animal, and 7. Quotes make a difference: animal is a name to look up, while "animal" is the actual word.

Literal or expression?

An expression is code that produces a value. A literal is one simple kind of expression. 3 + 4 is an expression containing two number literals and an addition operator. It produces seven, but is not itself a single number literal.

This distinction matters for event headers. after(2) accepts a directly written number in its allowed range. A variable containing two, or after(1 + 1), is not the same syntax, even though it could describe the same number.

Pliro also has Boolean and no-value literals, plus list and map literal forms. A list literal may contain expressions, such as [1, 2 + 3].

Try replacing "turtle" with "fox". Which output line changes? Only the one that looks up animal.

Text · Timers