Rust Programming Tutorial #12 - Tuples

preview_player
Показать описание
In this video I take you through the use of tuples in Rust. Tuples are essentially just a collection of values which may or may not be of the same type - they can even store other tuples!

I go over how you can access elements of a tuple and how to use destructing assignment to declare multiple variables from a tuple.

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

Good explanation and concept. I learned a lot of things in REST language in your good way. I hope that you will provide us with some projects in REST language to be trained on (required in the labor market) Thank you

liliasara
Автор

When accessing a tuple inside a tuple, does it actually read directly inside from the outer tuple or does it create a copy of the inner tuple in memory ?

Also, thanks for your series. I worked a lot with Python during the last years so I've become kind of lazy going back to C/C++ for low level projects, that's why I'm interested with Rust and your great series.

wholebrain
Автор

Can you refer to an element of a tuple besides using the numeric reference? Like through a loop, instead of using .1 or .2 etc... use .i ? I ask cos I tried and the compiler won't allow it.

AnGhaeilge
Автор

How to specify the types of the tuple elements?

sakuranooka
Автор

I like tuples more than arrays because you can have more than one data type in them :D. Like this, let my_tuple: (i64, bool, char) = (66733, true, 'hihi');

retrogamingbros
Автор

`{float}` is a primitive type and therefore doesn't have fields

pro_gemer
Автор

Tried to enter an iterative loop, Variable i Error writing code, I will try again
fn main() {
let i=1;
let tuple1=('a', 'b', 20, 6);
while i<=3{
println!(" {}", tuple1.i );
i=i+1;
}
}

liliasara
Автор

Your keyboard sounds like you are shooting a rifle. 🤣

ketaniralepatil
visit shbcf.ru