Cases and results come in pairs after the value, compared in order with == and only as far as needed. One more result at the end is what it gives when no case matches; without one, that is empty. Every result is the same kind.
Syntax
switch(value, case, result, otherwise?, …)Arguments marked ? are optional. An ellipsis (…) allows more arguments.
Try an example
switch(Title, "a", 1, "b", 2, 0)Returns 0 (number).
Change the example note’s properties
Run the expression to see its result here.
Date examples use 9 October 2026, 12:00 UTC. Examples run in your browser using Shelf’s formula engine.
Use it in your library
The example names the sample note’s properties. In the app, the formula editor shows the same example with your library’s own properties. Write a property name with spaces as prop("Target words"). The formula language reference explains values, operators, and lists.