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

is_tuple

def is_tuple(t: IntTuple) -> Bool

Check if an IntTuple represents a nested tuple.

This function determines whether the given IntTuple contains nested elements rather than a single integer value. It is the complement of the is_int function.

Example:

from layout.int_tuple import is_tuple, IntTuple

var single_value = IntTuple(5)
var nested_tuple = IntTuple(1, 2, 3)

var result1 = is_tuple(single_value)  # Returns False
var result2 = is_tuple(nested_tuple)  # Returns True

Args:

  • t (IntTuple): The IntTuple to check.

Returns:

Bool: True if the IntTuple contains nested elements, False if it's a single integer value.

Was this page helpful?