Compound types can group multiple values of other types into one type. Rust has two primitive compound types: tuples and arrays.
- "Compound Types" group multiple values of other types…into one type.…REST has two primitive compound types: "Tuples"…and "Arrays."…A tuple is a general way of grouping together some number…of other values with a variety of types into…one compound type.…We create tuples by writing a comma-separated list of values…inside parentheses.…"Destructuring" is a process where the tuple is…broken into a number of parts using pattern matching…which we'll be looking into.…
Also, we can access a tuple element directly by using…the period.…Let's go ahead and create a new file…and call it "tuples dot rs".…There's also another widely used pronunciation for "tuhpl"--…"tyoople"-- they're one and the same.…And like always, our main function goes first,…and inside that, our program logic.…Let's create a tuple which takes three types.…
So, I use a keyword: "let t-u-p".…For tuple, the first one is an integer of 32 bits,…the second one is a float of 64 bits, and the third one…is an unsigned int of 8 bits.…And then, we can assign this to three different values.…
- Installing Rust
- Data types
- Adjusting memory allocation
- Setting up race conditions
- Working with functions
- Exploring references and borrowing
- Using structs
- Method syntax
- Demonstrating recoverable errors with Result
- Working with enums
- Getting user input
Skill Level Beginner
1. Hello, Rust!
2. Basic Programming Concepts
3. Ownership in Rust
4. Data Handling and Pattern Matching in Rust
5. Error Handling
6. Sample Rust Project: The Guessing Game
Next steps1m 14s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.