Join Abhiram Ravikumar for an in-depth discussion in this video Control flow: While loops, part of First Look: Rust.
- [Instructor] It's often useful to execute…a block of code more than once.…For this task, let's convert several loops.…A loop runs through the code inside the loop body to…the end, and then starts immediately back at the beginning.…In order to evaluate a condition within…a loop, we use the while expression.…To loop through a collection, we use the for expression.…To experiment with loops, let's make…a new project and call it loops.…(typing)…Let's open up our main.rs file here.…
So, to use the loop…in Rust, we have a keyword and the keyword…is loop, please say it forward, right?…So the loop is followed by the calibresys, which is…the body of the loop, which gets executed multiple times.…So now let's go ahead and write a statement here.…(typing)…So I close it off with a semicolon, save the file.…So let me cd into the loops project, and on the project.…
(typing)…So as you can see, again gets printed multiple times.…To stop this, use control + c, so if…you're a mac, just hit command + c.…Well, this is not an efficient use of code.…
- 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.