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

Mojo function

signum

def signum(a: Int) -> Int

Returns the sign of an integer value.

This helper function determines whether a number is positive, negative, or zero, returning 1 for positive, -1 for negative, and 0 for zero.

Args:

  • a (Int): The integer value to determine the sign of.

Returns:

Int: 1 if a > 0, -1 if a < 0, 0 if a == 0.

Was this page helpful?