IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

oct

oct(value: Scalar, /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0o")) -> String

Returns the octal string representation of the given integer.

The octal representation is a base-8 encoding of the integer value.

The returned string will be prefixed with "0o" to indicate that the subsequent digits are octal.

Args:

Returns:

String: A string containing the octal representation of the given integer.

oct[T: Intable, //](value: T, /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0o")) -> String

Returns the octal string representation of the given integer.

The octal representation is a base-8 encoding of the integer value.

The returned string will be prefixed with "0o" to indicate that the subsequent digits are octal.

Parameters:

  • T (Intable): The intable type to represent in octal.

Args:

Returns:

String: A string containing the octal representation of the given integer.

oct(value: Scalar[DType.bool], /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0o")) -> String

Returns the octal string representation of the given scalar bool.

The octal representation is a base-8 encoding of the bool.

The returned string will be prefixed with "0o" to indicate that the subsequent digits are octal.

Args:

Returns:

String: A string containing the octal representation of the given bool.