Skip to main content

Type Conversion Built-ins

FunctionDescriptionMeta
to_number

num := to_number(value)

Converts value of type string, null or boolean to number. Numeric strings converts to the corresponding number when possible. Null and boolean false converts to 0 and boolean true to 1. Numbers are returned without conversion.

Arguments:
value (any<null, boolean, number, string>)

value to convert

Returns:
num (number)

the numeric representation of value

Wasm