Skip to content

Variables and values

Think of a variable as a labeled sticky note your app can write on and read back later. When a user enters their name, you can save it. When they tap a button, you can count the taps. When they move from one screen to the next, you can carry information with them.

Creating a variable

Use $name = value to create a variable and give it a starting value:

$greeting = "Hello, world"
$score = 0
$is-complete = false

Variable names start with $. Use hyphens to separate words — $user-name, $is-logged-in, $start-date. Spaces aren’t allowed in variable names.

Using a variable

To use a variable’s current value, write its name. Rhyme substitutes the value in place:

.text "Welcome, $username"
.text "Your score: $score"

You can use $varname anywhere a value goes — inside text, as an argument to an action, or in a condition.

Updating a variable

Assign a new value the same way:

$greeting = "Good morning"

The old value is replaced. A variable always holds exactly one value at a time — think of crossing out the old sticky note and writing a new one.

Saving a variable across sessions

By default, a variable lives only for the current session — it resets when the user closes and reopens the app. To save it so it survives reloads, use remember:

$username = "Alice"
remember $username

Next time the user opens the app, $username will still be "Alice". You can also save it for a set amount of time:

remember $session-token for 5m

After 5 minutes, the saved value is automatically cleared.

Types of values

Rhyme variables hold different kinds of data:

TypeWhat it isExample
TextWords, sentences, labels"Hello", "[email protected]"
NumberWhole or decimal numbers42, 3.14
True/falseA yes-or-no answertrue, false
ListAn ordered collection of items(from a data source or loop)
ItemA single row from a connected sheet(from a data source)

Rhyme figures out the type from the value you give it — you don’t declare a type up front.

For true/false values, true and false are the standard literals. Rhyme also accepts yes/no and on/off as alternatives.