← Back to blog
New Feature

Reusable calculations with arrow functions

· v0.9.3· 4 min read

Some calculations start small, then turn repetitive. You work out one project quote, one tax-inclusive price, or one unit conversion — and five lines later you’re typing the same formula again with different inputs.

Starting with CalNote v0.9.3, you can give that calculation a name. Arrow functions use familiar JavaScript-style notation, but their body follows the same CalNote rules as every other expression: arithmetic, percentages, units, currencies, dates, comparisons, and conditionals all work as expected.

Define once, call as often as you need

A function is a named assignment with parameters on the left of => and one CalNote expression on the right:

Use () when there are no parameters, skip the parentheses for one parameter, or separate several parameters with commas. The definition line stays blank in the results column; the value appears when you call the function.

Calls are expressions too. You can assign their result, put them inside parentheses, compare them, or pass one call into another.

A project quote you can reuse

Say you price freelance work from an hourly rate, then add a contingency percentage. Before functions, each estimate meant rebuilding that expression. Now the pricing rule lives in one place:

hourly_rate is defined above the function, so the body can use it alongside hours and contingency. Currency and percentage propagation are unchanged: 24 * €65 produces a euro value, then + 15% adds fifteen percent to that result.

This is the useful part of functions in a notepad calculator. The formula gets a readable name, while every call still shows its answer on the line where you need it.

Scale a recipe without repeating the ratio

Suppose a recipe serves four, but you’re cooking for ten. Every ingredient needs the same amount / 4 * 10 calculation. A function keeps that ratio in one place while each ingredient keeps its unit:

The results are 1,250 g, 500 g, and 300 g. Division and multiplication follow the existing unit rules, so amount stays a weight throughout the calculation. Change the final 10 to the number of guests you’re actually feeding and every ingredient uses the same scaling rule.

Function arguments can carry currencies, percentages, dates, and other supported units too. A function doesn’t strip the meaning from a value; its result keeps the same metadata CalNote would produce if you wrote the expression directly.

Dates and live now values work as well:

Because these calls depend on now, their results keep updating just like any other live date calculation.

Build a calculation from smaller functions

Functions can call functions defined above them. That makes it possible to name each step instead of squeezing a whole pricing rule onto one line:

with_fee reuses with_vat, then applies its own three-percent fee. Nested calls work anywhere a normal value would work, including inside arithmetic and ternary conditionals.

A few rules to keep functions predictable

CalNote borrows the compact arrow notation, not the whole JavaScript language:

  • Functions are named. Define them as name = (...) => expression, then call that name on a later line.
  • The body is one expression. There are no braces, return statements, or multiline bodies.
  • Dependencies go above the definition. Any board variable or function used by the body must already exist, following CalNote’s top-to-bottom flow.
  • Argument counts must match. A two-parameter function needs exactly two arguments.
  • Parameters are local. They only exist inside that function body and can safely shadow a board variable with the same name.

Default parameters, rest arguments, destructuring, passing functions as values, and recursion are intentionally out of scope. The goal is a small reusable layer over the calculations CalNote already understands.

Editor support is built in

Function names and parameters use the same syntax highlighting as variables, while => and commas are highlighted as operators. Defined functions appear in autocomplete with their parameter signature, and Cmd/Ctrl-click still jumps to the definition. Right-click a function name to rename it across the board.

The complete syntax is also listed under Operators & syntax in the Help modal.


Reusable functions are available from CalNote v0.9.3. Open app.calnote.eu, define a calculation you type more than once, and give it a name. Like everything else in CalNote, it works offline and stays in your browser.

Try reusable functions
Free, offline, no sign-up. Define double = x => x * 2 and call it anywhere below.
Open CalNote →