Rust Programming Tutorial #7 - Infinite Loop

preview_player
Показать описание
Alright so today we're looking at how we can put infinite loops in our Rust programs - this is done through the 'loop' keyword.

We also take a look at 'break' which is helpful when backing out of the loop and the 'continue' statement when we want to skip over some stuff.

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

A cool trick with loops is that you can "name" the loop. So you say 'outer: loop and 'inner: loop and say break 'outer; when you are in an inner loop... Very nice !

HermanWillems
Автор

Sweet tutorial mate, please keep them coming!

jereziah
Автор

It is unfortunate that loop labels are not in the video. Just today I wrote a for loop within a loop loop and break needed a label to break the outer loop. Nevertheless thank you for the overall great Videos!

HarmonicaTool
Автор

I had been wondering about this FOR a WHILE now (lol sorry)
If you had to make an infinite loop, why waste your time checking true after every iteration if you know you're going to go through the loop again? This feature makes sense.

comradepeter
Автор

Great tutorials. Loop is a new concept coming from c++ :D. I see this is a future tutorial, but wouldn't something like this be best done by a for loop?

retrogamingbros
Автор

same functionality than while ( true ), but I don't know about performance differences

igorsilva
Автор

Stop asking how's it going. Your public watches every SHORT episode

pynchia
welcome to shbcf.ru