## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

# Whats the difference between returning a tuple and array

I cant get the difference between returning a tuple and an array. In both cases i return multiple values. And if i want to use the key value thing i can just use any collection like a dictionary. so Whats its edge ?

With tuples, you have the ability to return a collection type consisting of different data types.

With arrays, all the items in the collection type must be of the same data type.

Also using tuples is more efficient...

(value1, value2, value3) = functionThatReturnsTuple

value = functionThatReturnsArray

value1 = value[0];

value2 = value[1];

value3 = value[2];

Samar Khanna what I was trying to demonstrate is the difference in using a tuple to store data versus using an array to store data...

When using a tuple, as shown above, it only takes one line

```(value1, value2, value3) = functionThatReturnsTuple
```

Where as using an array, to do the exact same thing, takes four lines

```value = functionThatReturnsArray

value1 = value[0];

value2 = value[1];

value3 = value[2];
```

I hope that helps

Samar Khanna what I was trying to demonstrate is the difference in using a tuple to store data versus using an array to store data...

When using a tuple, as shown above, it only takes one line

```(value1, value2, value3) = functionThatReturnsTuple
```

Where as using an array, to do the exact same thing, takes four lines

```value = functionThatReturnsArray

value1 = value[0];

value2 = value[1];

value3 = value[2];
```

I hope that helps