Inline calculations
Scratch evaluates lines that look like math and shows the result inline, in a faint pill at the end of the line. Nothing is written into the buffer until you accept it. Everything runs locally — the calculator never touches the network.
What gets evaluated
A line is evaluated when it contains at least one digit and at least one operator, conversion keyword, or function call. Plain prose, bare numbers, and lines that already end with = <number> are left alone.
| You type | You see |
|---|---|
2 + 2 | = 4 |
5 x 3 | = 15 |
(120 - 18) / 3 | = 34 |
200 + 10% | = 220 |
15% of 80 | = 12 |
sqrt(2) | = 1.414214 |
5 ft to m | = 1.524 m |
30 min in seconds | = 1800 s |
x (and X) between two numbers reads as multiplication, so 5 x 3 is the same as 5 * 3. Between identifiers it stays as a variable name, so x = 5 still assigns. List bullets and numbered items work too — - 3 * 4 gets a result the same as 3 * 4. Inside fenced code blocks, evaluation is skipped.
Variables and blocks
Assign a value with name = expression, then reference it on later lines. Variables are scoped to a block — a run of consecutive non-blank lines. A blank line resets the scope, which keeps unrelated blocks from leaking into each other.
tax = 0.0875
shipping = 12
100 + 100 * tax + shipping = 120.75
subtotal = 50
subtotal * 2 = 100
The second block has its own subtotal; it doesn’t see the first block’s tax.
Variables are italicized inline so you can spot them at a glance. As you type an identifier on a math-looking line, an autocomplete menu suggests the variables currently in scope (plus a small set of math functions like sqrt, round, min, max, and constants pi and e).
Units
Anything mathjs knows about works: length, mass, time, area, volume, temperature, data, angles. Use either to or in for conversion.
2.5 hours to minutes = 150 min
98 degF to degC = 36.667 degC
1 GB to MB = 1000 MB
Mixed-unit arithmetic compiles down to the left-hand unit:
5 ft + 3 in = 5.25 ft
Accepting a result
While the cursor is on a line with math, the result appears in a dashed preview pill at the end of the line, with a small ⇥ hint. Press Tab to bake the value into the buffer as plain text:
2 + 2 → 2 + 2 = 4
Tab only accepts when the cursor is at the end of the line; mid-line, it falls back to its usual indent / list behavior. ⌘= works the same way from anywhere on the line, for when your hands are already on the modifier row.
After accepting, the line is just Markdown — it survives copy/paste, export, and round-trips through any other Markdown tool.
Why no currency conversion
Live currency rates would mean reaching out to a server, and Scratch doesn’t make network calls — every other feature works fully offline, and the calculator stays consistent with that. For one-off conversions, Spotlight handles currency natively on macOS (⌘Space, then 100 usd in eur).
Turning it off
Toggle Settings → Editor → Inline calculations off if you’d rather have a buffer that only ever shows what you typed.