@num
Evaluate an arithmetic expression or convert a value to a number.
Returns: number
Syntax
Section titled “Syntax”@num(...tokens)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
[...tokens] |
any |
Arithmetic expression (e.g. $a + $b * 2) |
Examples
Section titled “Examples”# Basic arithmeticset $sum @num(1 + 2)
# Exponentiationset $pow @num(2 ^ 10)
# Expression with variablesset $a 10set $b 3set $result @num($a * $b + 1)
# Convert a string to numberset $n @num("42")See Also
Section titled “See Also”- @num.format — format with decimals (like
formatUnits) - @num.parse — parse a decimal string (like
parseUnits) - @bool — boolean expressions