Skip to content

Line References

Refer to the value of any earlier line by its line number. References stay correct as you insert or delete lines — the numbers are renumbered live.

Use line<N> or the short form l<N>. The keyword is case-insensitive, so line1, LINE1, Line1, l1, and L1 all refer to the same line.

Notes Calculator
Calculation example
CalculationResult
4242
line142
L142

Line references behave like any other value — combine them with operators, units, currencies, and other references.

Notes Calculator
Calculation example
CalculationResult
1010
55
line1 + line215
line1 * 220

A reference adopts the value type of the line it points to. If line 1 is an amount with units or a currency, the reference renders the same way:

Notes Calculator
Calculation example
CalculationResult
5 miles5 mi
line1 + 16 mi

Inserting a line above a reference or deleting a line shifts the numbers automatically — the text line1 is rewritten to line2 (and vice versa) so that the reference keeps pointing at the same logical line.

A line that references itself, references a line that doesn’t exist, or references a line that hasn’t been parsed yet resolves to NaN rather than raising an error. Arithmetic with a NaN reference also yields NaN.

Notes Calculator
Calculation example
CalculationResult
line5
line2

Only the bare line<N> and l<N> forms are recognised. The parser will not match references that are run together with other identifiers or contain underscores:

  • line1foo — not a reference (would need a space)
  • linear — not a reference (it’s a longer identifier)
  • l_3 — not a reference (underscores aren’t allowed)