Skip to main content
Version: v2

Integer Functions

abs

abs(): int

Returns the absolute value of an integer. If the integer is negative, it will return the positive value of it

Input example

<b>{{ -5.abs() }}</b>

Output

<b>5</b>

decimal

Read about this function HERE

float

float(): float

Converts an integer to a float by adding a decimal part of .0 to the number

Input example

<b>{{ 5.float() }}</b>

Output

<b>5.0</b>

len

len(): int

Returns the number of digits in an integer. If the integer is negative, it will return the number of digits excluding the - sign

Input example

<b>{{ 12345.len() }}</b>

Output

<b>5</b>

Input example

<b>{{ 1000.pretty() }}</b>

Output

<b>1,000</b>

str

str(): string

Converts an integer to a string and returns it

Input example

<b>{{ 5.str() }} and {{ -10.str() }}</b>

Output

<b>5 and -10</b>