Home : Technical Terms : Tuple Definition

Tuple

A tuple (pronounced "tuh-pull") is a data structure that stores a specific number of elements. These elements may include integers, characters, strings, or other data types.

Mathematics

The term "tuple" originates from math, rather than computer science. A math tuple may be defined as an "n-tuple," where "n" is the number of values the tuple contains. In mathematical expressions, tuples are represented by comma-delimited lists within parentheses. The following example is a "4-tuple," which has four values.

(3, 7, 13, 17)

Tuples serve a variety of purposes in mathematics. They are commonly used to represent a set of related values, such as prime numbers or mathematical sequences. A tuple can also display a range of input or output values for a function.

Computer Science

In computer programming, tuples provide an efficient way to store multiple values. Since they are static and cannot be modified, tuples generally require less memory than arrays. They are also flexible since they can store multiple data types. The following example is a "5-tuple," or a tuple that contains five values.

(11, 2020.07, "techterms", "C", -1000)

The "pentuple" above contains a positive integer (11), floating point number (2020.07), string (techterms), character (C), and a negative integer (-1000).

Tuples are an effective way to store data in computer programs, but not all programming languages support them. For example, Python and Java support tuples, but PHP and Ruby do not. If a language does not support tuples, an immutable array — one that cannot be modified — is the closest alternative.

Updated: July 11, 2020

Cite this definition:

https://techterms.com/definition/tuple

TechTerms - The Tech Terms Computer Dictionary

This page contains a technical definition of Tuple. It explains in computing terminology what Tuple means and is one of many technical terms in the TechTerms dictionary.

All definitions on the TechTerms website are written to be technically accurate but also easy to understand. If you find this Tuple definition to be helpful, you can reference it using the citation links above. If you think a term should be updated or added to the TechTerms dictionary, please email TechTerms!

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe at any time.
Questions? Please contact us.