Update 102-control-flow.md (#7182)

feat/changelog^2
Ahmad Asaad 4 weeks ago committed by GitHub
parent e78a7da1a9
commit 9b3ec7cc19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      src/data/roadmaps/rust/content/101-language-basics/100-syntax/102-control-flow.md

@ -1,7 +1,8 @@
# Control Flow Constructs
In Rust, control flow is managed through various structures, like `if`, `else`, `while`, `for`, and `match`. The `if` and `else` structures are used to execute different blocks of code based on certain conditions. Similar to other languages, `while` and `for` are used for looping over a block of code. The `while` loop repeats a block of code until the condition is false, and the `for` loop is used to iterate over a collection of values, such as an array or a range. Rust's `match` structure, which is similar to switch statements in other languages, is a powerful tool used for pattern matching: it checks through different cases defined by the programmer and executes the block where the match is found.
In Rust, control flow is managed through various structures, like `if`, `else`, `while`, `for`, `loop`, `match` and `if let`. The `if` and `else` structures are used to execute different blocks of code based on certain conditions. Similar to other languages, `while` and `for` are used for looping over a block of code. The `while` loop repeats a block of code until the condition is false, and the `for` loop is used to iterate over a collection of values, such as an array or a range. The `loop` keyword tells Rust to execute a block of code over and over again forever or until you explicitly tell it to stop. Rust's `match` structure, which is similar to switch statements in other languages, is a powerful tool used for pattern matching: it checks through different cases defined by the programmer and executes the block where the match is found. The `if let` syntax lets you combine `if` and `let` into a less verbose way to handle values that match one pattern while ignoring the rest.
Learn more from the following links:
- [@article@Control Flow](https://rust-book.cs.brown.edu/ch03-05-control-flow.html)
- [@article@Concise Control Flow with `if let`](https://rust-book.cs.brown.edu/ch06-03-if-let.html)

Loading…
Cancel
Save