Skip to main content
Version: v4.23

int

Casts an expression to an integer.

int(x:any) -> int

Description

The int function casts the provided value x to an integer. Non-integer values are truncated.

Examples

Cast a floating-point number to an integer

from {x: int(4.2)}
{x: 4}

Convert a string to an integer

from {x: int("42")}
{x: 42}

See Also

uint, float, time, str, ip