Rust Programming Tutorial #9 - For Loop

preview_player
Показать описание
In this video we take a look at for loops in Rust, which are unconventional compared to other languages such as C or Java. In Rust, you use for loops to loop over iterators.

We also look at using the enumerate function to gain access to the index we are currently at in the loop.

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

I seriously don't understand why you don't have over 500k of subscribers ! I've been your videos for a while and you're one of the best youtubers there are that explain things amazingly. thank you !

theartist
Автор

Just discovered these, really enjoying them and easy to understand

randyh
Автор

Thank you for the videos!! I have a really difficult time reading books about this stuff, so I very much appreciate you explaining everything so clearly and concisely.

dp-mason
Автор

You deserve way more subs and views man, this is such a great channel and resource for people learning rust. Just wanted to say keep doing what you're doing!

jacksmith
Автор

This is the first video of the series where we digress a bit prematurely. You haven't introduced ownership at all, so the iter saga is a bit foggy to most I assume. I am looking for this ownership lesson but this so nice to watch that I think I will just continue one by one.

paganaye
Автор

for loop in 1..11 loops from 1 to 10 by adding 1. My question is what we'd do if we wanted to iterate by more than 1 like in c we used for(i=1:i<=10;i++ or i+=1 or i+=2 or i+=3 or ...)


I am really thankful for your tutorials they're super easy and understandable for beginner. Big ups! <3

jaffasunny
Автор

very nice series; thank you for sharing your knowledge

samdavepollard
Автор

I have a question... (Great video for beginners btw!)
Why do we need the ".iter()" part? As you mention in the video it's because we want to reuse the "animals" variable.

But according to the variables video, can't we achieve the same thing with immutable referencing?
for a in &animals {...}

I tried it in an online compiler, and seems to work. Am I missing something?

shawon
Автор

range inclusive

let range= 1..=7;

for i in 1..=7 {}

igorsilva
Автор

What do you think of using the .for_each() method and a closure instead of a for loop ?

hv
Автор

how to make a program for Fahrenheit to centigrade conversion through loop please help

faisalfarooque
Автор

How to over complicate the tried and true “for loop”. JFC. No wonder C is still used. And what if you wanted to i+=5 on the index?

FPChris
Автор

One note the semi quotes aren't compulsory as of now.

LearnProgrammingInMalayalam
Автор

You haven’t explained vectors yet, so maybe link a video :)

julianmwagnerYT
Автор

let animals= vec!["conejo", "cao", "cato"];

for i in animals.iter()
{
print!("{}, ", i);
}

print!("{}", animals[0]); // run

igorsilva
Автор

Great channel btw. I’m just bashing on how terrible this syntax it. Just awful.

FPChris
Автор

"to make things a bit more clearER" ? Before Rust, consider learning English

pynchia