Numlex Documentation
Using Numlex
Report issue

Variables & functions

Assign values with name = expression, reuse them anywhere, and call the built-in math functions.

Variables let a sheet carry state the way a notebook carries marginal notes. Declare a value with name = expression; the name then stands for that value in every later line.

Assignments

hotel = 1240          1,240
hotel + 10%           1,364

room = 180 × 4        720
round(room / 3, 2)    240

Assignments are mutable: writing the same name again replaces it for the lines below. Names are 1–6 ASCII words, at most 40 characters, with no operators — the exact rules are in Sheet language.

Named values can hold units and money too (distance = 10 km, lunch = $45), and they work with exact integers (x = 0x1F).

Using functions

Functions work everywhere a number can appear: free expressions, assignments, Settings constants and unitless answer tokens. Names are case-insensitive, arguments are full expressions (nesting included), and a function-shaped line is strict: an unknown name, a bad arity or a domain failure is a precise error, never a guess.

sqrt(144)             12
sum(1, 2, 3)          6
pow(2, 10)            1,024
log10(1000)           3
sin(radians(30))      0.5

The complete function table (27 functions) — with arity, domains and examples — is in Built-in functions. The statistics and random functions (count, median, stdev, rand) power the tags, subtotals and statistics workflow documented in Tags, subtotals & statistics.

Commas inside calls

Inside an argument list a comma separates arguments. A comma directly before exactly three digits is still a thousands separator, so sum(1, 234) is two arguments while sum(1,234) is one grouped literal — and 1,234,567 outside a call is one number. Comma-decimal regional formats use ; between arguments instead: round(1,25; 0).

The separator rules are documented in Built-in functions.

Functions in call position

A built-in function takes precedence over a variable of the same name: a variable called sum still works in sum + 1, while sum(1, 2) calls the function. See Built-in functions for the strict call rules.

Settings constants

App-wide constants are a separate mechanism from sheet values — define them once in Settings → Constants and every sheet can use them. See Custom units & constants and the Settings & appearance guide.

Found an issue in these docs? Report it on GitHub