Number.to_radix
Number.to_radix
Function
Format an integer into a string according to the specified base.
Syntax
number.to_radix(radix)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| radix | Int | No | 10 | Target base; currently supports 2, 8, 16, other values return decimal strings. |
Return value
| Type | Description |
|---|---|
| String | Returns the converted string. |
Example
num = 255 result = num.to_radix(16) // Output: ff print result
Notes
- Integer values will be rounded according to BT relaxed rules before conversion.