Skip to main content
Log in

Mojo function

is_tuple

is_tuple(t: IntTuple[origin]) -> 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:

```mojo
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
```
.
```mojo
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[origin]): The IntTuple to check.

Returns:

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