From the course: Learning Julia

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Tuples

Tuples - Julia Tutorial

From the course: Learning Julia

Start my 1-month free trial

Tuples

- [Instructor] Another similarity that Julia shares with a language like Python is support for a collection type called a tuple, which we will examine in this lesson. So I'll open up the tuples_start file here in my editor and a tuple is an ordered sequence of elements just like an array, which we saw previously, but the key difference is that tuples are immutable. In other words, they can't be changed once they're created. Tuples are most useful for relatively small collections of values and Julia uses them in a variety of places. So, for example, the list arguments to a function is a tuple and you can use tuples to return multiple values from a function. To create a tuple, you enclose a set of values in parentheses. I can make a variable named tup and I can group some things together and notice I'm using parentheses instead of the square brackets. And I can put in multiple different kinds of data, so I've got some integers and strings and floating points and I'll put a character in…

Contents