Variable types
Variables and values covers the basics: create a variable with $name = value, and Rhyme figures out its type from whatever you assign. This page goes one level deeper — the full set of value kinds Rhyme recognizes, and exactly what to write to get each one.
You don’t declare a type up front. Rhyme looks at the shape of the value on the right-hand side of = and figures out what kind of value it is automatically. Knowing what shape produces what kind of value helps you predict how a variable will behave — for example, whether $time = 14:30 gives you a real time value you can compare and sort, or just a piece of text.
Copying another variable
$bar = $fooAssigning one variable to another copies its current value — and with it, whatever kind of value that already is. There’s no conversion here: if $foo holds a number, $bar becomes a number too; if $foo holds text, $bar becomes text. It isn’t fixed by the syntax — it depends entirely on what $foo holds at the time of assignment.
Text
$greet = "Hello"Anything in double quotes is text — words, sentences, labels, formatted strings. Same as covered in Variables and values.
Number
$age = 42A bare numeric literal — digits, optionally with a decimal point — is a number. No quotes, no suffix.
Time of day
$time = 14:30Write a bare hour:minute value (24-hour, optionally with a 12-hour am/pm suffix like 2:30pm) and Rhyme treats it as a real time value — one you can compare and sort — not just text that happens to look like a time.
This is different from writing a quoted "14:30", which is stored as plain text (see Dates and times). Both are valid; pick whichever fits your use case — text for straightforward display and storage, an unquoted time if you need Rhyme to treat it as an actual point in time.
Date
$date = 2024-03-20Write a bare year-month-day value and Rhyme treats it as a real date value, the same way it treats an unquoted time. As with times, this is distinct from writing a quoted "2024-03-20", which is stored as plain text (see Dates and times) — same shape, different kind of value depending on whether it’s quoted.
Duration
$duration = 10mA number immediately followed by a unit (ms, s/sec, m/min/minute, h/hour, d/day, w/week) becomes a duration. Rhyme converts it to milliseconds under the hood — 10m becomes 600000. That converted millisecond value is what gets stored and compared, not the original 10m text.
Block reference
$block = [test-block]Square brackets containing a lowercase-starting name become a block reference — pointing at a named block elsewhere in your app, not a list. Square brackets starting with an uppercase letter, a digit, a quote, or $ give you an array/list instead, so the case of that first character matters.
Item
$item = {name: Bob, age: 30}Curly braces define an item — a structured value with named fields, similar to a row from a connected sheet.
Dotted field access and assignment
$item.foo = 55You can read or set an individual field with dot notation. $item itself stays an item; the field you just set (foo) gets its own kind of value based on what you assigned it — here, a plain number. Assign a field a quoted string instead and that field would hold text, and so on — each field follows the same rules as a top-level variable.
Quick reference
For completeness, here are the same examples alongside Rhyme’s internal type names — the labels you may occasionally see surface in error messages or debugging output. You don’t need to know these to write Rhyme; the plain-English descriptions above are what matter day to day.
| Assign | Kind of value | Internal type name |
|---|---|---|
$bar = $foo | same as $foo | (depends on $foo) |
$greet = "Hello" | text | TEXT |
$age = 42 | number | NUMBER |
$block = [test-block] | block reference | BLOCKNAME |
$time = 14:30 | time value | DT_TIMEONLY |
$date = 2024-03-20 | date value | DT_DATEONLY |
$duration = 10m | duration, stored as 600000 | DT_DURATION |
$item = {name: Bob, age: 30} | item | ITEM |
$item.foo = 55 | item, with foo as a number | ITEM (field: NUMBER) |