Skip to main content
Log in

Mojo function

product

product[size: Int](tuple: StaticIntTuple[size], end_idx: Int) -> Int

Computes a product of values in the tuple up to the given index.

Parameters:

  • size (Int): The tuple size.

Args:

  • tuple (StaticIntTuple[size]): The tuple to get a product of.
  • end_idx (Int): The end index.

Returns:

The product of all tuple elements in the given range.

product[size: Int](tuple: StaticIntTuple[size], start_idx: Int, end_idx: Int) -> Int

Computes a product of values in the tuple in the given index range.

Parameters:

  • size (Int): The tuple size.

Args:

  • tuple (StaticIntTuple[size]): The tuple to get a product of.
  • start_idx (Int): The start index of the range.
  • end_idx (Int): The end index of the range.

Returns:

The product of all tuple elements in the given range.

Was this page helpful?