createUnit#
Create a user-defined unit and register it with the Unit type.
Available in: math cells, REPL.
Syntax#
createUnit(name, definition)
Arguments and behavior#
For persistent custom units, open Global Variables and create a Unit. Set its name, definition, aliases, prefixes and optional offset. Direct createUnit calls are runtime-wide and are not a persistent backup.
Example#
Unit registration changes the shared runtime. Use a full note or the Global Variables custom-unit editor.
createUnit("demoLength", "2 m")
3 demoLength to m